}
#endif
+#ifdef __linux__
/*
* Get the highest CPU id from sysfs.
*
return -1;
}
-#ifdef __linux__
/*
* On Linux try sysfs first and fallback to sysconf.
*/
#include <stdio.h>
#include <stdlib.h>
+#ifdef __linux__
+
#include "compat-smp.h"
int main(int argc, char *argv[])
else
return EXIT_FAILURE;
}
+
+#else
+
+int main(void)
+{
+ return EXIT_SUCCESS;
+}
+#endif
#include <stdio.h>
#include <stdlib.h>
+#ifdef __linux__
+
#include "compat-smp.h"
int main(int argc, char *argv[])
else
return EXIT_FAILURE;
}
+
+#else
+
+int main(void)
+{
+ return EXIT_SUCCESS;
+}
+#endif
ok $? "test_get_cpu_mask_from_sysfs - with '\n' expected: '$cpumask', result: '$result'"
}
-plan_tests $NUM_TESTS
+if [ "$URCU_TESTS_OS_TYPE" == "linux" ]; then
+ plan_tests $NUM_TESTS
-test_test_get_cpu_mask_from_sysfs ""
-test_test_get_cpu_mask_from_sysfs "0"
-test_test_get_cpu_mask_from_sysfs "0-3"
-test_test_get_cpu_mask_from_sysfs "0,3-7,9"
+ test_test_get_cpu_mask_from_sysfs ""
+ test_test_get_cpu_mask_from_sysfs "0"
+ test_test_get_cpu_mask_from_sysfs "0-3"
+ test_test_get_cpu_mask_from_sysfs "0,3-7,9"
+else
+ plan_skip_all "Linux specific tests."
+fi
ok $? "test_get_cpu_mask_from_sysfs_cxx - with '\n' expected: '$cpumask', result: '$result'"
}
-plan_tests $NUM_TESTS
+if [ "$URCU_TESTS_OS_TYPE" == "linux" ]; then
+ plan_tests $NUM_TESTS
-test_test_get_cpu_mask_from_sysfs_cxx ""
-test_test_get_cpu_mask_from_sysfs_cxx "0"
-test_test_get_cpu_mask_from_sysfs_cxx "0-3"
-test_test_get_cpu_mask_from_sysfs_cxx "0,3-7,9"
+ test_test_get_cpu_mask_from_sysfs_cxx ""
+ test_test_get_cpu_mask_from_sysfs_cxx "0"
+ test_test_get_cpu_mask_from_sysfs_cxx "0-3"
+ test_test_get_cpu_mask_from_sysfs_cxx "0,3-7,9"
+else
+ plan_skip_all "Linux specific tests."
+fi
#include "compat-smp.h"
+#ifdef __linux__
struct parse_test_data {
const char *buf;
int expected;
return exit_status();
}
+
+#else
+
+int main(void)
+{
+ plan_skip_all("Linux specific tests.");
+
+ return exit_status();
+}
+#endif
rm -rf "$TESTDIR"
}
-plan_tests $NUM_TESTS
+if [ "$URCU_TESTS_OS_TYPE" == "linux" ]; then
+ plan_tests $NUM_TESTS
-diag "get_max_cpuid_from_sysfs"
+ diag "get_max_cpuid_from_sysfs"
-test_data=(0 "cpu0")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(0 "cpu0")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(1 "cpu0" "cpu1")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(1 "cpu0" "cpu1")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(1 "cpu1" "cpu0")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(1 "cpu1" "cpu0")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(3 "cpu3")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(3 "cpu3")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(99 "cpu99")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(99 "cpu99")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(3 "cpu0" "cpu3")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(3 "cpu0" "cpu3")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(0 "cpu" "cpu0")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(0 "cpu" "cpu0")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(5 "cpu" "cpu5")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(5 "cpu" "cpu5")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(-1 "toto")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(-1 "toto")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(-1 "cpu")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(-1 "cpu")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(-1 "cpua" "cpud")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(-1 "cpua" "cpud")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
-test_data=(-1 "cpufreq" "cpuidle")
-test_get_max_cpuid_from_sysfs "${test_data[@]}"
+ test_data=(-1 "cpufreq" "cpuidle")
+ test_get_max_cpuid_from_sysfs "${test_data[@]}"
+else
+ plan_skip_all "Linux specific tests."
+fi
rm -rf "$TESTDIR"
}
-plan_tests $NUM_TESTS
+if [ "$URCU_TESTS_OS_TYPE" == "linux" ]; then
+ plan_tests $NUM_TESTS
-diag "get_max_cpuid_from_sysfs_cxx"
+ diag "get_max_cpuid_from_sysfs_cxx"
-test_data=(0 "cpu0")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(0 "cpu0")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(1 "cpu0" "cpu1")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(1 "cpu0" "cpu1")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(1 "cpu1" "cpu0")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(1 "cpu1" "cpu0")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(3 "cpu3")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(3 "cpu3")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(99 "cpu99")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(99 "cpu99")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(3 "cpu0" "cpu3")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(3 "cpu0" "cpu3")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(0 "cpu" "cpu0")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(0 "cpu" "cpu0")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(5 "cpu" "cpu5")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(5 "cpu" "cpu5")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(-1 "toto")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(-1 "toto")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(-1 "cpu")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(-1 "cpu")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(-1 "cpua" "cpud")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(-1 "cpua" "cpud")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
-test_data=(-1 "cpufreq" "cpuidle")
-test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+ test_data=(-1 "cpufreq" "cpuidle")
+ test_get_max_cpuid_from_sysfs_cxx "${test_data[@]}"
+else
+ plan_skip_all "Linux specific tests."
+fi
ret = get_possible_cpus_array_len();
ok(ret > 0, "get_possible_cpus_array_len (%d > 0)", ret);
+#ifdef __linux__
ret = get_num_possible_cpus_fallback();
ok(ret > 0, "get_num_possible_cpus_fallback (%d > 0)", ret);
+#else
+ skip(1, "Linux specific test.");
+#endif
return exit_status();
}