Userspace: Add quick test for global ctors and dtors

This commit is contained in:
Bananymous 2023-10-30 11:11:10 +02:00
parent bc1d1bf919
commit 382f9d9bb3
3 changed files with 32 additions and 0 deletions

View File

@ -23,6 +23,7 @@ set(USERSPACE_PROJECTS
sync
tee
test
test-globals
touch
u8sum
whoami

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.26)
project(test-globals CXX)
set(SOURCES
main.cpp
)
add_executable(test-globals ${SOURCES})
target_compile_options(test-globals PUBLIC -O2 -g)
target_link_libraries(test-globals PUBLIC libc)
add_custom_target(test-globals-install
COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/test-globals ${BANAN_BIN}/
DEPENDS test-globals
USES_TERMINAL
)

View File

@ -0,0 +1,14 @@
#include <stdio.h>
struct foo_t
{
foo_t() { printf("global constructor works\n"); }
~foo_t() { printf("global destructor works\n"); }
};
foo_t foo;
int main()
{
}