diff --git a/Userland/CMakeLists.txt b/Userland/CMakeLists.txt index b28ec2a968..d2beb4c401 100644 --- a/Userland/CMakeLists.txt +++ b/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) diff --git a/Userland/Tests/CMakeLists.txt b/Userland/Tests/CMakeLists.txt new file mode 100644 index 0000000000..32dd554bd8 --- /dev/null +++ b/Userland/Tests/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(Kernel) +add_subdirectory(LibC) diff --git a/Userland/Tests/Kernel/CMakeLists.txt b/Userland/Tests/Kernel/CMakeLists.txt new file mode 100644 index 0000000000..df6ebb70ac --- /dev/null +++ b/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) diff --git a/Tests/Kernel/bind-local-socket-to-symlink.cpp b/Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp similarity index 100% rename from Tests/Kernel/bind-local-socket-to-symlink.cpp rename to Userland/Tests/Kernel/bind-local-socket-to-symlink.cpp diff --git a/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp b/Userland/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp similarity index 100% rename from Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp rename to Userland/Tests/Kernel/bxvga-mmap-kernel-into-userspace.cpp diff --git a/Tests/Kernel/crash-fcntl-invalid-cmd.cpp b/Userland/Tests/Kernel/crash-fcntl-invalid-cmd.cpp similarity index 100% rename from Tests/Kernel/crash-fcntl-invalid-cmd.cpp rename to Userland/Tests/Kernel/crash-fcntl-invalid-cmd.cpp diff --git a/Tests/Kernel/elf-execve-mmap-race.cpp b/Userland/Tests/Kernel/elf-execve-mmap-race.cpp similarity index 99% rename from Tests/Kernel/elf-execve-mmap-race.cpp rename to Userland/Tests/Kernel/elf-execve-mmap-race.cpp index 2928a30f1e..05fed4f991 100644 --- a/Tests/Kernel/elf-execve-mmap-race.cpp +++ b/Userland/Tests/Kernel/elf-execve-mmap-race.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include volatile bool hax = false; diff --git a/Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp b/Userland/Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp similarity index 100% rename from Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp rename to Userland/Tests/Kernel/elf-symbolication-kernel-read-exploit.cpp diff --git a/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp b/Userland/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp similarity index 100% rename from Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp rename to Userland/Tests/Kernel/mmap-write-into-running-programs-executable-file.cpp diff --git a/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp b/Userland/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp similarity index 100% rename from Tests/Kernel/nanosleep-race-outbuf-munmap.cpp rename to Userland/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp diff --git a/Tests/Kernel/null-deref-close-during-select.cpp b/Userland/Tests/Kernel/null-deref-close-during-select.cpp similarity index 100% rename from Tests/Kernel/null-deref-close-during-select.cpp rename to Userland/Tests/Kernel/null-deref-close-during-select.cpp diff --git a/Tests/Kernel/null-deref-crash-during-pthread_join.cpp b/Userland/Tests/Kernel/null-deref-crash-during-pthread_join.cpp similarity index 100% rename from Tests/Kernel/null-deref-crash-during-pthread_join.cpp rename to Userland/Tests/Kernel/null-deref-crash-during-pthread_join.cpp diff --git a/Tests/Kernel/path-resolution-race.cpp b/Userland/Tests/Kernel/path-resolution-race.cpp similarity index 100% rename from Tests/Kernel/path-resolution-race.cpp rename to Userland/Tests/Kernel/path-resolution-race.cpp diff --git a/Tests/Kernel/pledge-test-failures.cpp b/Userland/Tests/Kernel/pledge-test-failures.cpp similarity index 93% rename from Tests/Kernel/pledge-test-failures.cpp rename to Userland/Tests/Kernel/pledge-test-failures.cpp index c085f2368c..38c6742a07 100644 --- a/Tests/Kernel/pledge-test-failures.cpp +++ b/Userland/Tests/Kernel/pledge-test-failures.cpp @@ -1,7 +1,7 @@ #include #include -int main(int argc, char** argv) +int main() { int res = pledge("stdio unix rpath", "stdio"); if (res < 0) { diff --git a/Tests/Kernel/pthread-cond-timedwait-example.cpp b/Userland/Tests/Kernel/pthread-cond-timedwait-example.cpp similarity index 100% rename from Tests/Kernel/pthread-cond-timedwait-example.cpp rename to Userland/Tests/Kernel/pthread-cond-timedwait-example.cpp diff --git a/Tests/Kernel/uaf-close-while-blocked-in-read.cpp b/Userland/Tests/Kernel/uaf-close-while-blocked-in-read.cpp similarity index 100% rename from Tests/Kernel/uaf-close-while-blocked-in-read.cpp rename to Userland/Tests/Kernel/uaf-close-while-blocked-in-read.cpp diff --git a/Userland/Tests/LibC/CMakeLists.txt b/Userland/Tests/LibC/CMakeLists.txt new file mode 100644 index 0000000000..51b1352ab7 --- /dev/null +++ b/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) diff --git a/Tests/LibC/accuracy-strtod.cpp b/Userland/Tests/LibC/accuracy-strtod.cpp similarity index 100% rename from Tests/LibC/accuracy-strtod.cpp rename to Userland/Tests/LibC/accuracy-strtod.cpp diff --git a/Tests/LibC/exec-should-not-search-current-directory.cpp b/Userland/Tests/LibC/exec-should-not-search-current-directory.cpp similarity index 100% rename from Tests/LibC/exec-should-not-search-current-directory.cpp rename to Userland/Tests/LibC/exec-should-not-search-current-directory.cpp diff --git a/Tests/LibC/memmem-tests.cpp b/Userland/Tests/LibC/memmem-tests.cpp similarity index 100% rename from Tests/LibC/memmem-tests.cpp rename to Userland/Tests/LibC/memmem-tests.cpp diff --git a/Tests/LibC/qsort-sorts-and-copies.cpp b/Userland/Tests/LibC/qsort-sorts-and-copies.cpp similarity index 100% rename from Tests/LibC/qsort-sorts-and-copies.cpp rename to Userland/Tests/LibC/qsort-sorts-and-copies.cpp