Skip to content

Commit f413354

Browse files
committed
add 'sqlite3 --version' & ctest to end of run_tests.sh; add ctest for sqlite3
1 parent 6154f63 commit f413354

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

tests/ctest/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.14.7)
2+
project(manylinux_ctest)
3+
include(CTest)
4+
5+
# SQLite3 test Derived from CMake unit test for FindSQLite3
6+
# https://gitlab.kitware.com/cmake/cmake/-/tree/master/Tests/FindSQLite3/Test
7+
find_package(SQLite3 REQUIRED)
8+
add_definitions(-DCMAKE_EXPECTED_SQLite3_VERSION="${SQLite3_VERSION}")
9+
add_executable(test_sqlite3 test_sqlite3.cpp)
10+
target_link_libraries(test_sqlite3 SQLite::SQLite3)
11+
add_test(NAME test_sqlite3 COMMAND test_sqlite3)

tests/ctest/test_sqlite3.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <iostream>
2+
#include <string>
3+
#include <sqlite3.h>
4+
5+
int main()
6+
{
7+
std::string expected_version = CMAKE_EXPECTED_SQLite3_VERSION;
8+
std::string found_version = SQLITE_VERSION;
9+
std::cout << "SQLite3: expecting version " << expected_version
10+
<< ", found verison " << found_version << std::endl;
11+
return expected_version.compare(found_version);
12+
}

tests/run_tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ patchelf --version
3737
git --version
3838
cmake --version
3939
swig -version
40+
sqlite3 --version
4041

4142
# check libcrypt.so.1 can be loaded by some system packages,
4243
# as LD_LIBRARY_PATH might not be enough.
@@ -51,3 +52,14 @@ else
5152
fi
5253
eval "$(ssh-agent)"
5354
eval "$(ssh-agent -k)"
55+
56+
# compilation tests, intended to ensure appropriate headers, pkg_config, etc.
57+
# are available for downstream compile against installed tools
58+
source_dir="${MY_DIR}/ctest"
59+
build_dir="$(mktemp -d)"
60+
cmake -S "${source_dir}" -B "${build_dir}"
61+
cmake --build "${build_dir}"
62+
(cd "${build_dir}"; ctest --output-on-failure)
63+
64+
# final report
65+
echo "run_tests successful!"

0 commit comments

Comments
 (0)