From 9e9d0768796e18ef7abb21b195c2af1152b82c58 Mon Sep 17 00:00:00 2001
From: Daniel Dunbar <daniel@zuster.org>
Date: Fri, 30 Aug 2013 19:52:12 +0000
Subject: [PATCH] [tests] Change with_system_lib feature to match what XFAIL
 lines expect.

 - The lit builtin XFAIL handling is more restrictive than what we were
   previously using, and for now I'd rather keep the lit one restrictive.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189692 91177308-0d34-0410-b5e6-96231b3b80d8
---
 test/lit.cfg | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/test/lit.cfg b/test/lit.cfg
index 6cb05ec5..dca6219a 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -2,15 +2,16 @@
 
 # Configuration file for the 'lit' test runner.
 
+import errno
 import os
-import sys
 import platform
-import tempfile
+import re
+import shlex
 import signal
 import subprocess
-import errno
+import sys
+import tempfile
 import time
-import shlex
 
 import lit.Test
 import lit.formats
@@ -284,5 +285,8 @@ if config.target_triple is None:
 # known to fail with versions of libc++ as were shipped with a particular
 # triple.
 if use_system_lib:
-    config.available_features.add('with_system_lib=%s' % (
-            config.target_triple,))
+    # Drop sub-major version components from the triple, because the current
+    # XFAIL handling expects exact matches for feature checks.
+    sanitized_triple = re.sub(r"([^-]+)-([^-]+)-([^-.]+).*", r"\1-\2-\3",
+                              config.target_triple)
+    config.available_features.add('with_system_lib=%s' % (sanitized_triple,))