Preparing more tests

This commit is contained in:
ptitSeb 2018-12-21 20:25:35 +01:00
parent c0e7a3da58
commit 4fd8951189
11 changed files with 42 additions and 1 deletions

View File

@ -51,4 +51,19 @@ target_link_libraries(box86 m dl rt)
add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test01 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref01.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
#add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test02 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref02.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
#add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test03 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref03.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
#add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/box86
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test04 yeah -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref04.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )

1
tests/ref02.txt Normal file
View File

@ -0,0 +1 @@
Hello World!

1
tests/ref03.txt Normal file
View File

@ -0,0 +1 @@
Hello World!

1
tests/ref04.txt Normal file
View File

@ -0,0 +1 @@
Hello, argc=2, argv[0]=./test04, argv[1]=yeah

0
tests/test01.c Executable file → Normal file
View File

BIN
tests/test02 Executable file

Binary file not shown.

9
tests/test02.c Normal file
View File

@ -0,0 +1,9 @@
#include <sys/syscall.h>
#include <unistd.h>
int main(int argc, char **argv)
{
const char msg[] = "Hello World!\n";
syscall(4, STDOUT_FILENO, msg, sizeof(msg)-1);
return 0;
}

BIN
tests/test03 Executable file

Binary file not shown.

7
tests/test03.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello World!\n");
return 0;
}

BIN
tests/test04 Executable file

Binary file not shown.

7
tests/test04.c Executable file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello, argc=%d, argv[0]=%s, argv[%d]=%s\n", argc, argv[0], argc-1, argv[argc-1]);
return 0;
}