Browse Source

Increase ctest coverage. Introduce optionally on intentional compile errors and warnings to the SmallAndFast project. Turn them on for the FailedSubmit tests to cover analyzing LABELS-related errors and warnings.

David Cole 16 years ago
parent
commit
680fae9c97

+ 8 - 0
Tests/CTestTest/SmallAndFast/CMakeLists.txt

@@ -15,3 +15,11 @@ set_property(TEST test1 APPEND PROPERTY LABELS TestLabel 1ArgTest Everything)
 
 add_test(test2 echoargs 1 2)
 set_property(TEST test2 APPEND PROPERTY LABELS TestLabel 2ArgTest Everything)
+
+if(SAF_INTENTIONAL_COMPILE_ERROR)
+  add_executable(ice intentional_compile_error.cxx)
+endif()
+
+if(SAF_INTENTIONAL_COMPILE_WARNING)
+  add_executable(icw intentional_compile_warning.cxx)
+endif()

+ 1 - 0
Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx

@@ -0,0 +1 @@
+garbage - obviously this should not compile as is

+ 11 - 0
Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx

@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main(int argc, const char* argv[])
+{
+  unsigned int i = 0; // "i<argc" should produce a "signed/unsigned comparison" warning
+  for (; i<argc; ++i)
+  {
+    fprintf(stdout, "%s\n", argv[i]);
+  }
+  return 0;
+}

+ 4 - 1
Tests/CTestTestFailedSubmits/test.cmake.in

@@ -11,6 +11,9 @@ set(CTEST_DROP_METHOD "@drop_method@")
 # Settings:
 SET(CTEST_USE_LAUNCHERS 1)
 
+# Emit these compiler warnings:
+set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Wall")
+
 SET(CTEST_SITE                          "@SITE@")
 SET(CTEST_BUILD_NAME                    "CTestTestLaunchers-@drop_method@")
 
@@ -32,7 +35,7 @@ CTEST_START(Experimental)
 # explicitly do not use CTEST_UPDATE - avoid network activity
 
 CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}"
-  OPTIONS "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}"
+  OPTIONS "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS};-DSAF_INTENTIONAL_COMPILE_ERROR:BOOL=ON;-DSAF_INTENTIONAL_COMPILE_WARNING:BOOL=ON"
   RETURN_VALUE res)
 CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
 CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)