meson: Support all tests from cmake
Unified test launch for both meson and cmake: make/ninja test. Support tests for cmake through ctest. Enable jid test in libdino. Enable tests for win64 CI/CD.
This commit is contained in:
parent
a74f2d0c82
commit
c1d2e3647b
4
.github/workflows/build-win64.yml
vendored
4
.github/workflows/build-win64.yml
vendored
|
@ -19,10 +19,10 @@ jobs:
|
|||
msys2 -c './build-win64.sh --prepare'
|
||||
- name: Build Dino (Meson, without saving)
|
||||
run: |
|
||||
msys2 -c './build-win64.sh -s meson -c -b -w'
|
||||
msys2 -c './build-win64.sh -s meson -c -b -t -w'
|
||||
- name: Build Dino (CMake)
|
||||
run: |
|
||||
msys2 -c './build-win64.sh -s cmake -c -b -i'
|
||||
msys2 -c './build-win64.sh -s cmake -c -b -t -i'
|
||||
- name: Build Dino installer
|
||||
run: |
|
||||
msys2 -c './build-win64.sh --build-installer'
|
||||
|
|
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
@ -12,8 +12,7 @@ jobs:
|
|||
- run: sudo apt-get install -y build-essential gettext cmake valac libgee-0.8-dev libsqlite3-dev libgtk-4-dev libnotify-dev libgpgme-dev libsoup2.4-dev libgcrypt20-dev libqrencode-dev libnice-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsrtp2-dev libwebrtc-audio-processing-dev libadwaita-1-dev libsignal-protocol-c-dev libcanberra-dev
|
||||
- run: ./configure --with-tests --with-libsignal-in-tree
|
||||
- run: make
|
||||
- run: build/xmpp-vala-test
|
||||
- run: build/omemo-test
|
||||
- run: make test
|
||||
build-meson:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
@ -25,7 +24,7 @@ jobs:
|
|||
- run: sudo apt-get install -y build-essential gettext libadwaita-1-dev libcanberra-dev libgcrypt20-dev libgee-0.8-dev libgpgme-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgtk-4-dev libnice-dev libnotify-dev libqrencode-dev libsignal-protocol-c-dev libsoup2.4-dev libsqlite3-dev libsrtp2-dev libwebrtc-audio-processing-dev meson valac
|
||||
- run: meson setup build -Dcrypto-backend=auto -Dplugin-ice=enabled -Duse-soup2=true
|
||||
- run: meson compile -C build
|
||||
- run: build/plugins/omemo/test_omemo
|
||||
- run: meson test -C build
|
||||
build-flatpak:
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
|
|
|
@ -10,6 +10,8 @@ else ()
|
|||
set(PROJECT_VERSION ${VERSION_FULL})
|
||||
endif ()
|
||||
|
||||
include(CTest)
|
||||
|
||||
# Prepare Plugins
|
||||
set(DEFAULT_PLUGINS omemo;openpgp;http-files;ice;rtp)
|
||||
if (WIN32)
|
||||
|
|
|
@ -95,7 +95,7 @@ prepare()
|
|||
configure_cmake()
|
||||
{
|
||||
msg "Running configuration for Windows"
|
||||
./configure --program-prefix="$DIST_DIR" --no-debug --release --disable-fast-vapi --with-libsoup3
|
||||
./configure --program-prefix="$DIST_DIR" --no-debug --release --disable-fast-vapi --with-libsoup3 --with-tests
|
||||
msg "Configured!"
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,12 @@ build_cmake()
|
|||
make install
|
||||
}
|
||||
|
||||
test_cmake()
|
||||
{
|
||||
msg "Run tests"
|
||||
make test
|
||||
}
|
||||
|
||||
configure_meson()
|
||||
{
|
||||
arg=${1:-"none"}
|
||||
|
@ -125,9 +131,14 @@ configure_meson()
|
|||
|
||||
build_meson()
|
||||
{
|
||||
cd $BUILD_DIR && ninja
|
||||
ninja install
|
||||
cd $PROJ_DIR
|
||||
meson compile -C $BUILD_DIR
|
||||
meson install -C $BUILD_DIR
|
||||
}
|
||||
|
||||
test_meson()
|
||||
{
|
||||
msg "Run tests"
|
||||
meson test -C $BUILD_DIR
|
||||
}
|
||||
|
||||
dist_install()
|
||||
|
@ -205,7 +216,7 @@ help()
|
|||
|
||||
Usage: $0 [option]
|
||||
|
||||
Note: you may set the multiple options, but be surem that they will be
|
||||
Note: you may set the multiple options, but be sure that they will be
|
||||
processed sequentially (one-by-one), e.g. command
|
||||
$0 -s meson -c -b
|
||||
will run buld config and _after_ that run build using meson, while
|
||||
|
@ -230,7 +241,10 @@ help()
|
|||
configure build using selected build-system.
|
||||
|
||||
--build, -b
|
||||
invoked build.
|
||||
invoke build.
|
||||
|
||||
--test, -t
|
||||
run tests.
|
||||
|
||||
--reconfig, -r
|
||||
reconfigure project, if minor changes were
|
||||
|
@ -281,6 +295,9 @@ do
|
|||
--build|-b)
|
||||
build_${build_sys}
|
||||
;;
|
||||
--test|-t)
|
||||
test_${build_sys}
|
||||
;;
|
||||
--reconfig|-r)
|
||||
configure_${build_sys} reconfig
|
||||
;;
|
||||
|
@ -306,6 +323,7 @@ do
|
|||
exit 1;
|
||||
fi
|
||||
build_sys=$2
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option $1"
|
||||
|
|
6
configure
vendored
6
configure
vendored
|
@ -15,7 +15,7 @@ eval set -- "$OPTS"
|
|||
PREFIX=${PREFIX:-/usr/local}
|
||||
ENABLED_PLUGINS=
|
||||
DISABLED_PLUGINS=
|
||||
BUILD_TESTS=
|
||||
BUILD_TESTS=no
|
||||
BUILD_TYPE=Debug
|
||||
DISABLE_FAST_VAPI=
|
||||
LIB_SUFFIX=
|
||||
|
@ -207,7 +207,7 @@ cmake -G "$cmake_type" \
|
|||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||
-DENABLED_PLUGINS="$ENABLED_PLUGINS" \
|
||||
-DDISABLED_PLUGINS="$DISABLED_PLUGINS" \
|
||||
-DBUILD_TESTS="$BUILD_TESTS" \
|
||||
-DBUILD_TESTING="$BUILD_TESTS" \
|
||||
-DUSE_SOUP3="$USE_SOUP3" \
|
||||
-DVALA_EXECUTABLE="$VALAC" \
|
||||
-DCMAKE_VALA_FLAGS="$VALACFLAGS" \
|
||||
|
@ -238,8 +238,6 @@ default:
|
|||
@sh -c "cd build; $exec_command"
|
||||
distclean: clean uninstall
|
||||
|
||||
test: default
|
||||
echo "make test not yet supported"
|
||||
%:
|
||||
@sh -c "cd build; $exec_command \"\$@\""
|
||||
EOF
|
||||
|
|
|
@ -112,12 +112,13 @@ install(TARGETS libdino ${TARGET_INSTALL})
|
|||
install(FILES ${CMAKE_BINARY_DIR}/exports/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino.deps DESTINATION ${VAPI_INSTALL_DIR})
|
||||
install(FILES ${CMAKE_BINARY_DIR}/exports/dino.h ${CMAKE_BINARY_DIR}/exports/dino_i18n.h DESTINATION ${INCLUDE_INSTALL_DIR})
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(BUILD_TESTING)
|
||||
vala_precompile(LIBDINO_TEST_VALA_C
|
||||
SOURCES
|
||||
"tests/weak_map.vala"
|
||||
"tests/testcase.vala"
|
||||
"tests/common.vala"
|
||||
"tests/jid.vala"
|
||||
CUSTOM_VAPIS
|
||||
${CMAKE_BINARY_DIR}/exports/dino_internal.vapi
|
||||
${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
|
||||
|
@ -131,4 +132,5 @@ if(BUILD_TESTS)
|
|||
add_definitions(${VALA_CFLAGS})
|
||||
add_executable(libdino-test ${LIBDINO_TEST_VALA_C})
|
||||
target_link_libraries(libdino-test libdino)
|
||||
endif(BUILD_TESTS)
|
||||
add_test(NAME libdino COMMAND libdino-test)
|
||||
endif(BUILD_TESTING)
|
||||
|
|
|
@ -88,3 +88,12 @@ dep_dino = declare_dependency(link_with: lib_dino, include_directories: include_
|
|||
|
||||
install_data('dino.deps', install_dir: get_option('datadir') / 'vala/vapi') # TODO: workaround for https://github.com/mesonbuild/meson/issues/9756
|
||||
install_headers('src/dino_i18n.h')
|
||||
|
||||
sources = files(
|
||||
'tests/weak_map.vala',
|
||||
'tests/testcase.vala',
|
||||
'tests/common.vala',
|
||||
'tests/jid.vala',
|
||||
)
|
||||
test_libdino = executable('test_libdino', sources, dependencies: dependencies + [dep_dino])
|
||||
test('libdino', test_libdino)
|
||||
|
|
|
@ -4,6 +4,7 @@ int main(string[] args) {
|
|||
GLib.Test.init(ref args);
|
||||
GLib.Test.set_nonfatal_assertions();
|
||||
TestSuite.get_root().add_suite(new WeakMapTest().get_suite());
|
||||
TestSuite.get_root().add_suite(new JidTest().get_suite());
|
||||
return GLib.Test.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Dino.Entities;
|
||||
using Xmpp;
|
||||
|
||||
namespace Dino.Test {
|
||||
|
||||
|
@ -12,27 +13,39 @@ class JidTest : Gee.TestCase {
|
|||
}
|
||||
|
||||
private void test_parse() {
|
||||
try {
|
||||
Jid jid = new Jid("user@example.com/res");
|
||||
fail_if(jid.localpart != "user");
|
||||
fail_if(jid.domainpart != "example.com");
|
||||
fail_if(jid.resourcepart != "res");
|
||||
fail_if(jid.to_string() != "user@example.com/res");
|
||||
} catch (Error e) {
|
||||
fail_if_reached(@"Throws $(e.message)");
|
||||
}
|
||||
}
|
||||
|
||||
private void test_components() {
|
||||
try {
|
||||
Jid jid = new Jid.components("user", "example.com", "res");
|
||||
fail_if(jid.localpart != "user");
|
||||
fail_if(jid.domainpart != "example.com");
|
||||
fail_if(jid.resourcepart != "res");
|
||||
fail_if(jid.to_string() != "user@example.com/res");
|
||||
} catch (Error e) {
|
||||
fail_if_reached(@"Throws $(e.message)");
|
||||
}
|
||||
}
|
||||
|
||||
private void test_with_res() {
|
||||
Jid jid = new Jid.with_resource("user@example.com", "res");
|
||||
try {
|
||||
Jid jid = new Jid("user@example.com").with_resource("res");
|
||||
fail_if(jid.localpart != "user");
|
||||
fail_if(jid.domainpart != "example.com");
|
||||
fail_if(jid.resourcepart != "res");
|
||||
fail_if(jid.to_string() != "user@example.com/res");
|
||||
} catch (Error e) {
|
||||
fail_if_reached(@"Throws $(e.message)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_D
|
|||
|
||||
install(TARGETS omemo ${PLUGIN_INSTALL})
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(BUILD_TESTING)
|
||||
vala_precompile(OMEMO_TEST_VALA_C
|
||||
SOURCES
|
||||
"tests/signal/common.vala"
|
||||
|
@ -127,4 +127,5 @@ if(BUILD_TESTS)
|
|||
add_executable(omemo-test ${OMEMO_TEST_VALA_C})
|
||||
add_dependencies(omemo-test omemo)
|
||||
target_link_libraries(omemo-test omemo ${OMEMO_PACKAGES})
|
||||
endif(BUILD_TESTS)
|
||||
add_test(NAME omemo COMMAND omemo-test)
|
||||
endif(BUILD_TESTING)
|
||||
|
|
|
@ -177,7 +177,7 @@ install(TARGETS xmpp-vala ${TARGET_INSTALL})
|
|||
install(FILES ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/xmpp-vala.deps DESTINATION ${VAPI_INSTALL_DIR})
|
||||
install(FILES ${CMAKE_BINARY_DIR}/exports/xmpp-vala.h DESTINATION ${INCLUDE_INSTALL_DIR})
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(BUILD_TESTING)
|
||||
vala_precompile(ENGINE_TEST_VALA_C
|
||||
SOURCES
|
||||
"tests/common.vala"
|
||||
|
@ -198,4 +198,5 @@ if(BUILD_TESTS)
|
|||
add_definitions(${VALA_CFLAGS})
|
||||
add_executable(xmpp-vala-test ${ENGINE_TEST_VALA_C})
|
||||
target_link_libraries(xmpp-vala-test xmpp-vala ${SIGNAL_PROTOCOL_PACKAGES})
|
||||
endif(BUILD_TESTS)
|
||||
add_test(NAME xmpp-vala COMMAND xmpp-vala-test)
|
||||
endif(BUILD_TESTING)
|
||||
|
|
|
@ -136,3 +136,14 @@ lib_xmpp_vala = library('xmpp-vala', sources, c_args: c_args, vala_args: vala_ar
|
|||
dep_xmpp_vala = declare_dependency(link_with: lib_xmpp_vala, include_directories: include_directories('.'))
|
||||
|
||||
install_data('xmpp-vala.deps', install_dir: get_option('datadir') / 'vala/vapi') # TODO: workaround for https://github.com/mesonbuild/meson/issues/9756
|
||||
|
||||
sources = files(
|
||||
'tests/common.vala',
|
||||
'tests/testcase.vala',
|
||||
'tests/jid.vala',
|
||||
'tests/stanza.vala',
|
||||
'tests/color.vala',
|
||||
'tests/util.vala',
|
||||
)
|
||||
test_xmpp_vala = executable('test_xmpp_vala', sources, vala_args: vala_args, dependencies: dependencies + [dep_xmpp_vala])
|
||||
test('xmpp-vala', test_xmpp_vala)
|
||||
|
|
Loading…
Reference in a new issue