From: Brian Aker Date: Thu, 8 Mar 2012 09:03:50 +0000 (-0800) Subject: Update/fix for OSX X-Git-Tag: 1.0.5~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=cda6d9fa2609c76f533f9172e325c707f4ab8d26;p=awesomized%2Flibmemcached Update/fix for OSX --- diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc index 22f0399d..efe03040 100644 --- a/libtest/cmdline.cc +++ b/libtest/cmdline.cc @@ -231,7 +231,6 @@ Application::error_t Application::run(const char *args[]) if (spawn_ret) { - Error << print(); return Application::INVALID; } diff --git a/libtest/cpu.cc b/libtest/cpu.cc index 774e4f39..d75df955 100644 --- a/libtest/cpu.cc +++ b/libtest/cpu.cc @@ -23,12 +23,16 @@ #include +#if defined(HAVE_SYS_SYSCTL_H) && HAVE_SYS_SYSCTL_H +#include +#endif + namespace libtest { size_t number_of_cpus() { size_t number_of_cpu= 1; -#ifdef TARGET_OS_LINUX +#if TARGET_OS_LINUX number_of_cpu= sysconf(_SC_NPROCESSORS_ONLN); #elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU) && defined(HW_AVAILCPU) && defined(HW_NCPU) int mib[4]; @@ -51,6 +55,8 @@ size_t number_of_cpus() number_of_cpu = 1; } } +#else + fprintf(stderr, "Going with guessing\n"); #endif return number_of_cpu; diff --git a/libtest/unittest.cc b/libtest/unittest.cc index 9945e386..06914724 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -362,7 +362,11 @@ static test_return_t application_doesnotexist_BINARY(void *) Application true_app("doesnotexist"); const char *args[]= { "--fubar", 0 }; +#if defined(TARGET_OS_OSX) && TARGET_OS_OSX + test_compare(Application::INVALID, true_app.run(args)); +#else test_compare(Application::SUCCESS, true_app.run(args)); +#endif // Behavior is different if we are running under valgrind if (getenv("TESTS_ENVIRONMENT") and strstr(getenv("TESTS_ENVIRONMENT"), "valgrind")) { @@ -370,7 +374,11 @@ static test_return_t application_doesnotexist_BINARY(void *) } else { +#if defined(TARGET_OS_OSX) && TARGET_OS_OSX + test_compare(Application::FAILURE, true_app.wait()); +#else test_compare(Application::INVALID, true_app.wait()); +#endif } test_compare(0, true_app.stdout_result().size()); @@ -561,6 +569,10 @@ static test_return_t wait_services_appliction_TEST(void *) static test_return_t gdb_wait_services_appliction_TEST(void *) { +#if defined(TARGET_OS_OSX) && TARGET_OS_OSX + test_skip(0, TARGET_OS_OSX); +#endif + test_skip(0, access("/etc/services", R_OK )); libtest::Application wait_app("libtest/wait", true); @@ -575,6 +587,10 @@ static test_return_t gdb_wait_services_appliction_TEST(void *) static test_return_t gdb_abort_services_appliction_TEST(void *) { +#if defined(TARGET_OS_OSX) && TARGET_OS_OSX + test_skip(0, TARGET_OS_OSX); +#endif + libtest::Application abort_app("libtest/abort", true); abort_app.use_gdb();