Userspace: Add quick test for global ctors and dtors
This commit is contained in:
17
userspace/test-globals/CMakeLists.txt
Normal file
17
userspace/test-globals/CMakeLists.txt
Normal 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
|
||||
)
|
||||
14
userspace/test-globals/main.cpp
Normal file
14
userspace/test-globals/main.cpp
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user