Changes in / [6609050:18cc83c] in mainline
- Files:
-
- 73 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r6609050 r18cc83c 21 21 kernel/generic/src/debug/real_map.bin 22 22 uspace/app/bdsh/bdsh 23 uspace/app/bdsh/test-bdsh 23 24 uspace/app/bithenge/bithenge 24 25 uspace/app/blkdump/blkdump … … 184 185 uspace/dist/srv/udf 185 186 uspace/dist/srv/udp 187 uspace/dist/test/* 186 188 uspace/drv/audio/hdaudio/hdaudio 187 189 uspace/drv/audio/sb16/sb16 … … 221 223 uspace/lib/c/arch/amd64/_link.ld 222 224 uspace/lib/c/arch/amd64/include/libarch/common.h 225 uspace/lib/c/test-libc 226 uspace/lib/pcut/test-libpcut-* 223 227 uspace/lib/posix/collisions.list 224 228 uspace/lib/posix/redefs-hide-libc.xargs 225 229 uspace/lib/posix/redefs-show-posix.xargs 226 230 uspace/lib/posix/include/libc 231 uspace/lib/posix/test-libposix 232 uspace/lib/uri/test-liburi 227 233 uspace/srv/audio/hound/hound 228 234 uspace/srv/bd/file_bd/file_bd -
HelenOS.config
r6609050 r18cc83c 600 600 ! CONFIG_WRITE_CORE_FILES (n/y) 601 601 602 % Include userspace unit tests (PCUT) 603 ! CONFIG_PCUT_TESTS (n/y) 604 605 % Include PCUT self-tests 606 ! CONFIG_PCUT_SELF_TESTS (n/y) 607 602 608 % Include development files (headers, libraries) 603 609 ! CONFIG_DEVEL_FILES (n/y) -
boot/Makefile
r6609050 r18cc83c 68 68 cp "$$file" "$(DIST_PATH)/app/" ; \ 69 69 done 70 ifeq ($(CONFIG_PCUT_TESTS),y) 71 echo "echo Running all tests..." >"$(DIST_PATH)/test/run_all" 72 echo "<html><head><title>HelenOS test results</title></head><body>" >"$(DIST_PATH)/test/test.html" 73 echo "<h1>HelenOS test results</h1><ul>" >>"$(DIST_PATH)/test/test.html" 74 for file in $(RD_TESTS) ; do \ 75 file2=`basename $$file`; \ 76 cp "$$file" "$(DIST_PATH)/test/" ; \ 77 echo "echo ' ->' $$file2" >>"$(DIST_PATH)/test/run_all"; \ 78 echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \ 79 echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \ 80 echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_all"; \ 81 echo "<li><a href=\"result-$$file2.txt\">$$file2</a></li>" >>"$(DIST_PATH)/test/test.html"; \ 82 done 83 echo "cp -f /test/test.html /data/web/test.html" >>"$(DIST_PATH)/test/run_all" 84 echo "</ul></body></html>" >>"$(DIST_PATH)/test/test.html" 85 endif 86 87 ifeq ($(CONFIG_PCUT_SELF_TESTS),y) 88 echo "echo Running all PCUT self-tests..." >"$(DIST_PATH)/test/run_pcut" 89 echo "<html><head><title>Results of PCUT self-tests on HelenOS</title></head><body>" >"$(DIST_PATH)/test/pcut.html" 90 echo "<h1>Results of PCUT self-tests on HelenOS</h1><ul>" >>"$(DIST_PATH)/test/pcut.html" 91 for file in $(USPACE_PATH)/lib/pcut/test-libpcut-*; do \ 92 file2=`basename $$file`; \ 93 name=`echo "$$file2" | sed 's/test-libpcut-//'`; \ 94 cp "$$file" "$(DIST_PATH)/test/" ; \ 95 echo "echo ' ->' $$name" >>"$(DIST_PATH)/test/run_pcut"; \ 96 echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \ 97 echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \ 98 echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_pcut"; \ 99 echo "<li><a href=\"result-$$file2.txt\">$$name</a></li>" >>"$(DIST_PATH)/test/pcut.html"; \ 100 done 101 echo "cp -f /test/pcut.html /data/web/pcut.html" >>"$(DIST_PATH)/test/run_pcut" 102 echo "</ul></body></html>" >>"$(DIST_PATH)/test/pcut.html" 103 endif 104 70 105 for drv in $(RD_DRVS) ; do \ 71 106 drv_dir="`dirname "$$drv"`" ; \ … … 100 135 rm -rf $(USPACE_PATH)/dist/inc/* 101 136 rm -f $(USPACE_PATH)/dist/app/* 137 rm -f $(USPACE_PATH)/dist/test/* 102 138 rm -f $(USPACE_PATH)/dist/cfg/net/* -
boot/Makefile.common
r6609050 r18cc83c 222 222 $(USPACE_PATH)/app/fontviewer/fontviewer 223 223 224 RD_TESTS = \ 225 $(USPACE_PATH)/lib/c/test-libc \ 226 $(USPACE_PATH)/lib/posix/test-libposix \ 227 $(USPACE_PATH)/lib/uri/test-liburi \ 228 $(USPACE_PATH)/app/bdsh/test-bdsh 229 230 224 231 COMPONENTS = \ 225 232 $(KERNEL_PATH)/kernel.bin \ -
uspace/Makefile
r6609050 r18cc83c 233 233 lib/usbvirt \ 234 234 lib/pcm \ 235 lib/pcut \ 235 236 lib/bithenge \ 236 237 lib/posix \ … … 242 243 LIBN_BUILD = $(addsuffix .build,$(LIBN)) 243 244 BUILDS := $(addsuffix .build,$(DIRS)) 245 BUILDS_TESTS := $(addsuffix .build-test,$(DIRS) $(LIBS) lib/c) 244 246 245 247 CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(LIBN)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC)) … … 247 249 .PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD) $(BUILDS) $(CLEANS) clean 248 250 249 all: $(BUILDS) 251 all: $(BUILDS) $(BUILDS_TESTS) 252 253 $(BUILDS_TESTS): $(BUILDS) 254 $(MAKE) -C $(basename $@) all-test PRECHECK=$(PRECHECK) 250 255 251 256 clean: $(CLEANS) -
uspace/Makefile.common
r6609050 r18cc83c 78 78 JOB = $(BINARY).job 79 79 OUTPUT = $(BINARY) 80 TEST_BINARY = test-$(BINARY) 80 81 EXTRA_OUTPUT += $(BINARY).disasm 81 82 EXTRA_CLEAN += $(BINARY).map … … 85 86 JOB = $(LIBRARY).job 86 87 OUTPUT = $(LIBRARY).a 88 TEST_BINARY = test-$(LIBRARY) 87 89 endif 88 90 … … 201 203 endif 202 204 205 # PCUT-based unit tests 206 ifneq ($(TEST_SOURCES),) 207 TEST_OUTPUT = $(TEST_BINARY) 208 TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__ 209 TEST_OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a 210 EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map 211 ifneq ($(LIBRARY),) 212 TEST_OUTPUT_LIBS += $(OUTPUT) 213 endif 214 TEST_OUTPUT_LIBS += $(TEST_LIBS) 215 endif 216 203 217 .PHONY: all clean 204 218 205 219 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 206 220 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 221 222 all-test: $(TEST_OUTPUT) 207 223 208 224 clean: … … 295 311 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 296 312 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES))) 313 TEST_OBJECTS := $(addsuffix .test.o,$(basename $(TEST_SOURCES))) 297 314 298 315 ifneq ($(BINARY),) … … 339 356 endif 340 357 358 ifneq ($(TEST_OUTPUT),) 359 $(TEST_OUTPUT): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) 360 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(TEST_OUTPUT).map -o $@ $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) $(LIBS) $(BASE_LIBS) 361 ifeq ($(CONFIG_STRIP_BINARIES),y) 362 $(STRIP) $(TEST_OUTPUT) 363 endif 364 endif 365 341 366 %.o: %.S $(DEPEND) 342 367 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@ … … 357 382 endif 358 383 384 %.test.o: %.c $(DEPEND) 385 $(CC) $(DEFS) $(CFLAGS) $(TEST_CFLAGS) -c $< -o $@ 386 ifeq ($(PRECHECK),y) 387 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) 388 endif 389 359 390 %.lo: %.S $(DEPEND) 360 391 $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@ … … 376 407 377 408 $(DEPEND): $(PRE_DEPEND) 378 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null409 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) $(TEST_SOURCES) > $@ 2> /dev/null 379 410 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@ 380 411 -
uspace/app/bdsh/Makefile
r6609050 r18cc83c 65 65 tok.c 66 66 67 TEST_SOURCES = \ 68 tok.c \ 69 test/toktest.c 70 67 71 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/c/Makefile
r6609050 r18cc83c 165 165 $(ARCH_SOURCES) 166 166 167 TEST_SOURCES = \ 168 test/main.c \ 169 test/sprintf.c 170 167 171 include $(USPACE_PREFIX)/Makefile.common 168 172 -
uspace/lib/posix/Makefile
r6609050 r18cc83c 79 79 source/unistd.c 80 80 81 TEST_SOURCES = \ 82 test/main.c \ 83 test/scanf.c 84 81 85 include $(USPACE_PREFIX)/Makefile.common 82 86 -
uspace/lib/posix/source/stdio/scanf.c
r6609050 r18cc83c 1220 1220 } 1221 1221 1222 // FIXME: put the testcases to the app/tester after scanf is included into libc1223 1224 #if 01225 1226 //#include <stdio.h>1227 //#include <malloc.h>1228 //#include <string.h>1229 1230 #define test_val(fmt, exp_val, act_val) \1231 if (exp_val == act_val) { \1232 printf("succ, expected "fmt", actual "fmt"\n", exp_val, act_val); \1233 } else { \1234 printf("fail, expected "fmt", actual "fmt"\n", exp_val, act_val); \1235 ++fail; \1236 }1237 1238 #define test_str(fmt, exp_str, act_str) \1239 if (posix_strcmp(exp_str, act_str) == 0) { \1240 printf("succ, expected "fmt", actual "fmt"\n", exp_str, act_str); \1241 } else { \1242 printf("fail, expected "fmt", actual "fmt"\n", exp_str, act_str); \1243 ++fail; \1244 }1245 1246 void __posix_scanf_test(void);1247 void __posix_scanf_test(void)1248 {1249 int fail = 0;1250 1251 int ret;1252 1253 unsigned char uhh;1254 signed char shh;1255 unsigned short uh;1256 short sh;1257 unsigned udef;1258 int sdef;1259 unsigned long ul;1260 long sl;1261 unsigned long long ull;1262 long long sll;1263 void *p;1264 1265 float f;1266 double d;1267 long double ld;1268 1269 char str[20];1270 char seq[20];1271 char scanset[20];1272 1273 char *pstr;1274 char *pseq;1275 char *pscanset;1276 1277 ret = posix_sscanf(1278 "\n j tt % \t -121314 98765 aqw 0765 0x77 0xABCDEF88 -99 884",1279 " j tt %%%3hhd%1hhu%3hd %3hu%u aqw%n %lo%llx %p %li %lld",1280 &shh, &uhh, &sh, &uh, &udef, &sdef, &ul, &ull, &p, &sl, &sll);1281 test_val("%d", -12, shh);1282 test_val("%u", 1, uhh);1283 test_val("%d", 314, sh);1284 test_val("%u", 987, uh);1285 test_val("%u", 65, udef);1286 test_val("%d", 28, sdef);1287 test_val("%lo", (unsigned long) 0765, ul);1288 test_val("%llx", (unsigned long long) 0x77, ull);1289 test_val("%p", (void *) 0xABCDEF88, p);1290 test_val("%ld", (long) -99, sl);1291 test_val("%lld", (long long) 884, sll);1292 test_val("%d", 10, ret);1293 1294 ret = posix_sscanf(1295 "\n \t\t1.0 -0x555.AP10 1234.5678e12",1296 "%f %lf %Lf",1297 &f, &d, &ld);1298 test_val("%f", 1.0, f);1299 test_val("%lf", (double) -0x555.AP10, d);1300 test_val("%Lf", (long double) 1234.5678e12, ld);1301 test_val("%d", 3, ret);1302 1303 ret = posix_sscanf(1304 "\n\n\thello world \n",1305 "%5s %ms",1306 str, &pstr);1307 test_str("%s", "hello", str);1308 test_str("%s", "world", pstr);1309 test_val("%d", 2, ret);1310 free(pstr);1311 1312 ret = posix_sscanf(1313 "\n\n\thello world \n",1314 " %5c %mc",1315 seq, &pseq);1316 seq[5] = '\0';1317 pseq[1] = '\0';1318 test_str("%s", "hello", seq);1319 test_str("%s", "w", pseq);1320 test_val("%d", 2, ret);1321 free(pseq);1322 1323 ret = posix_sscanf(1324 "\n\n\th-e-l-l-o world-] \n",1325 " %9[-eh-o] %m[^]-]",1326 scanset, &pscanset);1327 test_str("%s", "h-e-l-l-o", scanset);1328 test_str("%s", "world", pscanset);1329 test_val("%d", 2, ret);1330 free(pscanset);1331 1332 printf("Failed: %d\n", fail);1333 }1334 1335 #endif1336 1337 1222 /** @} 1338 1223 */ -
uspace/lib/uri/Makefile
r6609050 r18cc83c 36 36 uri.c 37 37 38 TEST_SOURCES = \ 39 test/main.c \ 40 test/parser.c 41 38 42 include $(USPACE_PREFIX)/Makefile.common
Note:
See TracChangeset
for help on using the changeset viewer.