Browse Source

Tests: Build automatically, fix compilation errors

Ben Wiederhake 5 years ago
parent
commit
29eceebdbf

+ 2 - 0
Userland/CMakeLists.txt

@@ -37,3 +37,5 @@ target_link_libraries(test-crypto LibCrypto LibTLS LibLine)
 target_link_libraries(test-js LibJS LibLine LibCore)
 target_link_libraries(test-web LibWeb)
 target_link_libraries(tt LibPthread)
+
+add_subdirectory(Tests)

+ 2 - 0
Userland/Tests/CMakeLists.txt

@@ -0,0 +1,2 @@
+add_subdirectory(Kernel)
+add_subdirectory(LibC)

+ 15 - 0
Userland/Tests/Kernel/CMakeLists.txt

@@ -0,0 +1,15 @@
+file(GLOB CMD_SOURCES "*.cpp")
+
+foreach(CMD_SRC ${CMD_SOURCES})
+    get_filename_component(CMD_NAME ${CMD_SRC} NAME_WE)
+    add_executable(${CMD_NAME} ${CMD_SRC})
+    target_link_libraries(${CMD_NAME} LibCore)
+    install(TARGETS ${CMD_NAME} RUNTIME DESTINATION usr/Tests/Kernel)
+endforeach()
+
+target_link_libraries(elf-execve-mmap-race LibPthread)
+target_link_libraries(nanosleep-race-outbuf-munmap LibPthread)
+target_link_libraries(null-deref-close-during-select LibPthread)
+target_link_libraries(null-deref-crash-during-pthread_join LibPthread)
+target_link_libraries(uaf-close-while-blocked-in-read LibPthread)
+target_link_libraries(pthread-cond-timedwait-example LibPthread)

+ 0 - 0
Tests/Kernel/bind-local-socket-to-symlink.cpp → Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp


+ 0 - 0
Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp → Userland/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp


+ 0 - 0
Tests/Kernel/crash-fcntl-invalid-cmd.cpp → Userland/Tests/Kernel/crash-fcntl-invalid-cmd.cpp


+ 1 - 0
Tests/Kernel/elf-execve-mmap-race.cpp → Userland/Tests/Kernel/elf-execve-mmap-race.cpp

@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <sys/wait.h>
 #include <unistd.h>
 
 volatile bool hax = false;

+ 0 - 0
Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp → Userland/Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp


+ 0 - 0
Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp → Userland/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp


+ 0 - 0
Tests/Kernel/nanosleep-race-outbuf-munmap.cpp → Userland/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp


+ 0 - 0
Tests/Kernel/null-deref-close-during-select.cpp → Userland/Tests/Kernel/null-deref-close-during-select.cpp


+ 0 - 0
Tests/Kernel/null-deref-crash-during-pthread_join.cpp → Userland/Tests/Kernel/null-deref-crash-during-pthread_join.cpp


+ 0 - 0
Tests/Kernel/path-resolution-race.cpp → Userland/Tests/Kernel/path-resolution-race.cpp


+ 1 - 1
Tests/Kernel/pledge-test-failures.cpp → Userland/Tests/Kernel/pledge-test-failures.cpp

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-int main(int argc, char** argv)
+int main()
 {
     int res = pledge("stdio unix rpath", "stdio");
     if (res < 0) {

+ 0 - 0
Tests/Kernel/pthread-cond-timedwait-example.cpp → Userland/Tests/Kernel/pthread-cond-timedwait-example.cpp


+ 0 - 0
Tests/Kernel/uaf-close-while-blocked-in-read.cpp → Userland/Tests/Kernel/uaf-close-while-blocked-in-read.cpp


+ 10 - 0
Userland/Tests/LibC/CMakeLists.txt

@@ -0,0 +1,10 @@
+file(GLOB CMD_SOURCES "*.cpp")
+
+foreach(CMD_SRC ${CMD_SOURCES})
+    get_filename_component(CMD_NAME ${CMD_SRC} NAME_WE)
+    add_executable(${CMD_NAME} ${CMD_SRC})
+    target_link_libraries(${CMD_NAME} LibCore)
+    install(TARGETS ${CMD_NAME} RUNTIME DESTINATION usr/Tests/LibC)
+endforeach()
+
+#target_link_libraries(foobar LibPthread)

+ 0 - 0
Tests/LibC/accuracy-strtod.cpp → Userland/Tests/LibC/accuracy-strtod.cpp


+ 0 - 0
Tests/LibC/exec-should-not-search-current-directory.cpp → Userland/Tests/LibC/exec-should-not-search-current-directory.cpp


+ 0 - 0
Tests/LibC/memmem-tests.cpp → Userland/Tests/LibC/memmem-tests.cpp


+ 0 - 0
Tests/LibC/qsort-sorts-and-copies.cpp → Userland/Tests/LibC/qsort-sorts-and-copies.cpp