There was an error while loading. Please reload this page.
2 parents f086778 + 165659e commit 95507cbCopy full SHA for 95507cb
tests/bsdtests.c
@@ -164,6 +164,20 @@ test_uint32_format(uint32_t actual, uint32_t expected, const char *format, ...)
164
_test_uint32(NULL, 0, desc, actual, expected);
165
}
166
167
+void
168
+_test_uint32_not(const char* file, long line, const char* desc, uint32_t actual, uint32_t unexpected)
169
+{
170
+ _test_print(file, line, desc,
171
+ (actual != unexpected), "%u", actual, "!%u", unexpected);
172
+}
173
+
174
175
+test_uint32_not_format(uint32_t actual, uint32_t unexpected, const char *format, ...)
176
177
+GENERATE_DESC
178
+_test_uint32_not(NULL, 0, desc, actual, unexpected);
179
180
181
void
182
_test_int32(const char* file, long line, const char* desc, int32_t actual, int32_t expected)
183
{
tests/bsdtests.h
@@ -111,6 +111,10 @@ void _test_uint32(const char* file, long line, const char* desc, uint32_t actual
111
#define test_uint32(a,b,c) _test_uint32(__SOURCE_FILE__, __LINE__, a, b, c)
112
void test_uint32_format(uint32_t actual, uint32_t expected, const char *format, ...) __printflike(3,4);
113
114
+void _test_uint32_not(const char* file, long line, const char* desc, uint32_t actual, uint32_t unexpected);
115
+#define test_uint32_not(a,b,c) _test_uint32(__SOURCE_FILE__, __LINE__, a, b, c)
116
+void test_uint32_not_format(uint32_t actual, uint32_t unexpected, const char *format, ...) __printflike(3,4);
117
118
void _test_int32(const char* file, long line, const char* desc, int32_t actual, int32_t expected);
119
#define test_int32(a,b,c) _test_int32(__SOURCE_FILE__, __LINE__, a, b, c)
120
void test_int32_format(int32_t actual, int32_t expected, const char* format, ...) __printflike(3,4);
tests/dispatch_workqueue.c
@@ -59,7 +59,8 @@ activecpu(void)
59
activecpu = si.dwNumberOfProcessors;
60
#else
61
size_t s = sizeof(activecpu);
62
- sysctlbyname("hw.activecpu", &activecpu, &s, NULL, 0);
+ if (sysctlbyname("hw.activecpu", &activecpu, &s, NULL, 0) != 0)
63
+ return 0;
64
#endif
65
return activecpu;
66
@@ -70,6 +71,7 @@ int
70
71
main(void)
72
73
uint32_t ncpu = activecpu();
74
+test_uint32_not("Failed to get CPU count", ncpu, 0);
75
76
dispatch_test_start("Dispatch workqueue");
77
0 commit comments