Skip to content

Commit c17d2b3

Browse files
committed
add test
1 parent 58bfad1 commit c17d2b3

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.24)
2+
3+
project(whole)
4+
5+
add_library(whole_lib STATIC lib.cpp)
6+
add_executable(whole main.cpp)
7+
target_link_libraries(whole $<LINK_LIBRARY:WHOLE_ARCHIVE,whole_lib>)

test/cmake/whole_archive/lib.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <iostream>
2+
3+
static void init(void) __attribute__((constructor));
4+
static void init(void) {
5+
std::cout << "init" << std::endl;
6+
}

test/cmake/whole_archive/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <iostream>
2+
3+
int main() {
4+
std::cout << "main" << std::endl;
5+
}

test/cmake/whole_archive/out.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
init
2+
main

test/test_other.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,12 +909,13 @@ def test_emstrip(self):
909909
# would take 10 minutes+ to finish (CMake feature detection is slow), so
910910
# combine multiple features into one to try to cover as much as possible
911911
# while still keeping this test in sensible time limit.
912-
'js': ('target_js', 'test_cmake.js', ['-DCMAKE_BUILD_TYPE=Debug']),
913-
'html': ('target_html', 'hello_world_gles.html', ['-DCMAKE_BUILD_TYPE=Release']),
914-
'library': ('target_library', 'libtest_cmake.a', ['-DCMAKE_BUILD_TYPE=MinSizeRel']),
915-
'static_cpp': ('target_library', 'libtest_cmake.a', ['-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DCPP_LIBRARY_TYPE=STATIC']),
916-
'stdproperty': ('stdproperty', 'helloworld.js', []),
917-
'post_build': ('post_build', 'hello.js', []),
912+
'js': ('target_js', 'test_cmake.js', ['-DCMAKE_BUILD_TYPE=Debug']),
913+
'html': ('target_html', 'hello_world_gles.html', ['-DCMAKE_BUILD_TYPE=Release']),
914+
'library': ('target_library', 'libtest_cmake.a', ['-DCMAKE_BUILD_TYPE=MinSizeRel']),
915+
'static_cpp': ('target_library', 'libtest_cmake.a', ['-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DCPP_LIBRARY_TYPE=STATIC']),
916+
'whole_archive': ('whole_archive', 'whole.js', []),
917+
'stdproperty': ('stdproperty', 'helloworld.js', []),
918+
'post_build': ('post_build', 'hello.js', []),
918919
})
919920
def test_cmake(self, test_dir, output_file, cmake_args):
920921
# Test all supported generators.

0 commit comments

Comments
 (0)