summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-11-20 23:47:54 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-11-20 23:49:46 +0000
commit360a44d608f59df92fe409db5057311e955c5d12 (patch)
tree466c684d5eebeb00bcbf3ea7a7479f3feadd7de9
parent699d4bafd0fb1e2e7bf12e62a3c9673bc4bfa578 (diff)
downloadgentoo-utils-360a44d608f59df92fe409db5057311e955c5d12.tar.gz
port check.sh to use only meson
-rwxr-xr-xcheck.sh28
-rw-r--r--meson.build4
-rw-r--r--meson.options1
3 files changed, 20 insertions, 13 deletions
diff --git a/check.sh b/check.sh
index 3abe597..0608a59 100755
--- a/check.sh
+++ b/check.sh
@@ -2,25 +2,27 @@
source /etc/profile
-export CC=clang CXX=clang++
+export PATH="${HOME}/.local/bin:${PATH}" CC=clang CXX=clang++
-cargo fmt --check || exit $?
+if command -v ldd; then
+ export LDFLAGS=-fuse-ld=lld
+fi
-cargo clippy || exit $?
+for file in $(find src -type f -name '*.rs'); do
+ rustfmt --edition 2024 --check ${file} || exit $?
+done
-cargo test -r || exit $?
+if [[ ! -d build ]]; then
+ meson setup -Dtests=enabled build || exit $?
+fi
-cargo build --all --all-features || exit $?
+meson compile -C build || exit $?
-build=$(mktemp -d)
+ninja clippy -C build || exit $?
-meson setup ${build} || exit $?
-
-meson compile -C ${build} || exit $?
-
-meson test -C ${build} || exit $?
-
-rm -rf ${build}
+for test in unittests; do
+ meson test -v ${test} -C build || exit $?
+done
# hack to make sure we use the system meson, since meson format from git is broken
/usr/bin/meson format --recursive --check-only || exit $?
diff --git a/meson.build b/meson.build
index c415bf4..d671ba5 100644
--- a/meson.build
+++ b/meson.build
@@ -20,6 +20,10 @@ gentoo_utils = static_library(
link_with: [thiserror],
)
+if get_option('test').enabled()
+ rust.test('unittests', gentoo_utils)
+endif
+
if get_option('fuzz').enabled()
subdir('fuzz')
endif
diff --git a/meson.options b/meson.options
index 4d0ae09..02fa153 100644
--- a/meson.options
+++ b/meson.options
@@ -1 +1,2 @@
option('fuzz', type: 'feature', value: 'disabled')
+option('test', type: 'feature', value: 'disabled') \ No newline at end of file