diff --git a/CMakeLists.txt b/CMakeLists.txt index c0e308587..56894a26f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,3 +26,4 @@ message(STATUS "SDK_SYSROOT_DIR=${SDK_SYSROOT_DIR}") add_subdirectory(toolchain) add_subdirectory(libraries) +add_subdirectory(tests) diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt index e576fbc84..81d977584 100644 --- a/libraries/CMakeLists.txt +++ b/libraries/CMakeLists.txt @@ -17,5 +17,4 @@ ExternalProject_Add( -DCMAKE_C_COMPILER=i586-kolibrios-gcc -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR} - DEPENDS copy-kos-app-lds ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..b65dcbe0e --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,12 @@ +# Rules for building tests + +# Pseudo libc (kos-crt-stub) +ExternalProject_Add( + test-hello + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hello + CMAKE_ARGS + -DCMAKE_C_COMPILER=i586-kolibrios-gcc + -DCMAKE_C_COMPILER_WORKS=1 + -DCMAKE_INSTALL_PREFIX=${SDK_SYSROOT_DIR} + BUILD_ALWAYS TRUE +) diff --git a/example/CMakeLists.txt b/tests/hello/CMakeLists.txt similarity index 100% rename from example/CMakeLists.txt rename to tests/hello/CMakeLists.txt diff --git a/tests/hello/hello.c b/tests/hello/hello.c new file mode 100644 index 000000000..45cca4085 --- /dev/null +++ b/tests/hello/hello.c @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: GPL-2.0 + * Copyright (C) 2025 KolibriOS team +*/ + +int main() +{ + char *hello = "I: Hello KolibriOS from GCC!\n"; + while(*hello) { + __asm__ __inline__("int $0x40" ::"a"(63), "b"(1), "c"(*hello)); + hello++; + } +}