Valgrind returns a different error for invalid binary.
authorBrian Aker <brian@tangent.org>
Mon, 5 Mar 2012 01:28:24 +0000 (17:28 -0800)
committerBrian Aker <brian@tangent.org>
Mon, 5 Mar 2012 01:28:24 +0000 (17:28 -0800)
libtest/unittest.cc

index bffa4ecbf6544cd50b694bd13b14d3c234a99893..9945e38690451906f56776d4b522a1a62e86e019 100644 (file)
@@ -363,7 +363,15 @@ static test_return_t application_doesnotexist_BINARY(void *)
 
   const char *args[]= { "--fubar", 0 };
   test_compare(Application::SUCCESS, true_app.run(args));
-  test_compare(Application::INVALID, true_app.wait());
+  // Behavior is different if we are running under valgrind
+  if (getenv("TESTS_ENVIRONMENT") and strstr(getenv("TESTS_ENVIRONMENT"), "valgrind"))
+  {
+    test_compare(Application::FAILURE, true_app.wait());
+  }
+  else
+  {
+    test_compare(Application::INVALID, true_app.wait());
+  }
   test_compare(0, true_app.stdout_result().size());
 
   return TEST_SUCCESS;