[cfe-commits] [libcxxabi] r149413 - in /libcxxabi/trunk/test: dynamic_cast_stress.cpp test_vector1.cpp testit

Howard Hinnant hhinnant at apple.com
Tue Jan 31 12:10:33 PST 2012


Author: hhinnant
Date: Tue Jan 31 14:10:33 2012
New Revision: 149413

URL: http://llvm.org/viewvc/llvm-project?rev=149413&view=rev
Log:
Drop the stress a notch on dynamic_cast_stress.cpp.  Otherwise it occasionally causes clang to crash.  Put a noexcept(false) on a throwing destructor in test_vector1.cpp.  The test now passes for both C++03 and C++11 modes.  Add testit script.  All tests are now PASSING :-)

Added:
    libcxxabi/trunk/test/testit   (with props)
Modified:
    libcxxabi/trunk/test/dynamic_cast_stress.cpp
    libcxxabi/trunk/test/test_vector1.cpp

Modified: libcxxabi/trunk/test/dynamic_cast_stress.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/dynamic_cast_stress.cpp?rev=149413&r1=149412&r2=149413&view=diff
==============================================================================
--- libcxxabi/trunk/test/dynamic_cast_stress.cpp (original)
+++ libcxxabi/trunk/test/dynamic_cast_stress.cpp Tue Jan 31 14:10:33 2012
@@ -53,7 +53,7 @@
     typedef std::chrono::high_resolution_clock Clock;
     typedef std::chrono::duration<double, std::micro> US;
     const std::size_t Width = 20;
-    const std::size_t Depth = 7;
+    const std::size_t Depth = 6;
     A<Width, Depth> a;
     typedef B<Width/2, Depth> Destination;
 //    typedef A<Width, Depth> Destination;

Modified: libcxxabi/trunk/test/test_vector1.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_vector1.cpp?rev=149413&r1=149412&r2=149413&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_vector1.cpp (original)
+++ libcxxabi/trunk/test/test_vector1.cpp Tue Jan 31 14:10:33 2012
@@ -49,10 +49,16 @@
 void throw_construct ( void *p ) { if ( gConstructorCounter   == gConstructorThrowTarget ) throw 1; ++gConstructorCounter; }
 void throw_destruct  ( void *p ) { if ( ++gDestructorCounter  == gDestructorThrowTarget  ) throw 2; }
 
+#if __has_feature(cxx_noexcept)
+#   define CAN_THROW noexcept(false)
+#else
+#   define CAN_THROW
+#endif
+
 struct vec_on_stack {
     void *storage;
     vec_on_stack () : storage ( __cxxabiv1::__cxa_vec_new    (            10, 40, 8, throw_construct, throw_destruct )) {}
-    ~vec_on_stack () {          __cxxabiv1::__cxa_vec_delete ( storage,       40, 8,                  throw_destruct );  }
+    ~vec_on_stack () CAN_THROW {__cxxabiv1::__cxa_vec_delete ( storage,       40, 8,                  throw_destruct );  }
     };
 
 //  Test calls with empty constructors and destructors

Added: libcxxabi/trunk/test/testit
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/testit?rev=149413&view=auto
==============================================================================
--- libcxxabi/trunk/test/testit (added)
+++ libcxxabi/trunk/test/testit Tue Jan 31 14:10:33 2012
@@ -0,0 +1,129 @@
+#!/bin/bash
+# //===--------------------------- testit ---------------------------------===//
+# //
+# //                     The LLVM Compiler Infrastructure
+# //
+# // This file is distributed under the University of Illinois Open Source
+# // License. See LICENSE.TXT for details.
+# //
+# //===--------------------------------------------------------------------===//
+
+export DYLD_LIBRARY_PATH=/Users/hhinnant/Development/libcxxabi/lib:/Users/hhinnant/Development/temp_libcxx/lib
+
+if [ -z $CC ]
+then
+	CC=clang++
+fi
+
+if [ -z "$OPTIONS" ]
+then
+	OPTIONS="-std=c++0x -stdlib=libc++"
+fi
+
+case $TRIPLE in
+  *-*-mingw* | *-*-cygwin* | *-*-win*)
+	TEST_EXE=test.exe
+    ;;
+  *)
+    TEST_EXE=a.out
+    ;;
+esac
+
+FAIL=0
+PASS=0
+UNIMPLEMENTED=0
+IMPLEMENTED_FAIL=0
+IMPLEMENTED_PASS=0
+
+function afunc
+{
+	fail=0
+	pass=0
+	if (ls *.fail.cpp &> /dev/null)
+	then
+		for FILE in $(ls *.fail.cpp); do
+			if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE &> /dev/null
+			then
+				rm ./$TEST_EXE
+				echo "$FILE should not compile"
+				let "fail+=1"
+			else
+				let "pass+=1"
+			fi
+		done
+	fi
+
+	if (ls *.cpp &> /dev/null)
+	then
+		for FILE in $(ls *.cpp); do
+			if $CC $OPTIONS $HEADER_INCLUDE $SOURCE_LIB $FILE $LIBS -o ./$TEST_EXE
+			then
+				if ./$TEST_EXE
+				then
+					rm ./$TEST_EXE
+					let "pass+=1"
+				else
+					echo "$FILE failed at run time"
+					let "fail+=1"
+					rm ./$TEST_EXE
+				fi
+			else
+				echo "$FILE failed to compile"
+				let "fail+=1"
+			fi
+		done
+	fi
+
+	if [ $fail -gt 0 ]
+	then
+		echo "failed $fail tests in `pwd`"
+		let "IMPLEMENTED_FAIL+=1"
+	fi
+	if [ $pass -gt 0 ]
+	then
+		echo "passed $pass tests in `pwd`"
+		if [ $fail -eq 0 ]
+		then
+			let "IMPLEMENTED_PASS+=1"
+		fi
+	fi
+	if [ $fail -eq 0 -a $pass -eq 0 ]
+	then
+		echo "not implemented:  `pwd`"
+		let "UNIMPLEMENTED+=1"
+	fi
+
+	let "FAIL+=$fail"
+	let "PASS+=$pass"
+
+	for FILE in *
+	do
+		if [ -d "$FILE" ];
+		then
+			cd $FILE
+			afunc
+			cd ..
+		fi
+	done
+}
+
+afunc
+
+echo "****************************************************"
+echo "Results for `pwd`:"
+echo "using `$CC --version`"
+echo "with $OPTIONS $HEADER_INCLUDE $SOURCE_LIB"
+echo "----------------------------------------------------"
+echo "sections without tests   : $UNIMPLEMENTED"
+echo "sections with failures   : $IMPLEMENTED_FAIL"
+echo "sections without failures: $IMPLEMENTED_PASS"
+echo "                       +   ----"
+echo "total number of sections : $(($UNIMPLEMENTED+$IMPLEMENTED_FAIL+$IMPLEMENTED_PASS))"
+echo "----------------------------------------------------"
+echo "number of tests failed   : $FAIL"
+echo "number of tests passed   : $PASS"
+echo "                       +   ----"
+echo "total number of tests    : $(($FAIL+$PASS))"
+echo "****************************************************"
+
+exit $FAIL

Propchange: libcxxabi/trunk/test/testit
------------------------------------------------------------------------------
    svn:executable = *





More information about the cfe-commits mailing list