forked from Bananymous/banan-os
				
			Userspace: Add quick test for global ctors and dtors
This commit is contained in:
		
							parent
							
								
									7c6832cee4
								
							
						
					
					
						commit
						a63006afaf
					
				| 
						 | 
				
			
			@ -23,6 +23,7 @@ set(USERSPACE_PROJECTS
 | 
			
		|||
	sync
 | 
			
		||||
	tee
 | 
			
		||||
	test
 | 
			
		||||
	test-globals
 | 
			
		||||
	touch
 | 
			
		||||
	u8sum
 | 
			
		||||
	whoami
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -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()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue