aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArsen Arsenović <arsen@aarsen.me>2022-06-24 10:19:20 +0200
committerSam James <sam@gentoo.org>2022-07-12 07:33:20 +0100
commit063fcaeaa05074a9d90acec2f68b25dfb8ecd279 (patch)
tree0e8963a74ae52de9b034f1f255f6873868d94f63 /tests
parentseccomp: allow madvise() call (glibc 2.35+) (diff)
downloadpax-utils-063fcaeaa05074a9d90acec2f68b25dfb8ecd279.tar.gz
pax-utils-063fcaeaa05074a9d90acec2f68b25dfb8ecd279.tar.bz2
pax-utils-063fcaeaa05074a9d90acec2f68b25dfb8ecd279.zip
Convert build system to meson
Some notes about the new build systems: - I don't fully understand the testing system, but I think I understood it well enough to implement an equivalent one. - use_seccomp could be replaced by detecting seccomp support at runtime (without support, Linux returns -EINVAL in include/linux/seccomp.h) - The fuzzing test is broken and seems to have been for a while (see commit 67f3ba64c91b5e1ac9fbbd0bc039fb8ca653cae1, it fails to fuzz on my machine) - make-tarball.sh has been replaced with meson dist - hopefully this works. meson dist should also call seccomp-bpf.c to update seccomp-bpf.h Signed-off-by: Arsen Arsenović <arsen@aarsen.me> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile10
-rw-r--r--tests/lddtree/Makefile13
-rw-r--r--tests/lddtree/meson.build10
-rw-r--r--tests/lib.sh13
-rw-r--r--tests/scanelf/Makefile8
-rwxr-xr-xtests/scanelf/dotest6
-rw-r--r--tests/scanelf/meson.build8
-rw-r--r--tests/source/Makefile8
-rwxr-xr-xtests/source/dotest29
-rw-r--r--tests/source/meson.build8
10 files changed, 30 insertions, 83 deletions
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index f4b81e8..0000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-SUBDIRS = $(patsubst %/Makefile,%,$(wildcard */Makefile))
-abs_top_srcdir = $(realpath $(PWD)/..)
-abs_top_builddir = $(realpath $(PWD)/..)
-# DO NOT STARE AT THE SUN
-all:
-%:; $(MAKE) `printf '%s_$@_ ' $(SUBDIRS)`
-_words = $(subst _, ,$1)
-_dir = $(firstword $(call _words,$@))
-_targ = $(lastword $(call _words,$@))
-%_:; $(MAKE) -C $(_dir) $(_targ) srcdir=$(abs_top_srcdir)/tests/$(_dir) builddir=$(abs_top_builddir)/tests/$(_dir)
diff --git a/tests/lddtree/Makefile b/tests/lddtree/Makefile
deleted file mode 100644
index 3a13e28..0000000
--- a/tests/lddtree/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: check
-
-%.check:
- ./dotest-$(@:.check=)
-
-test check: sh.check
-ifneq ($(USE_PYTHON),no)
-test check: py.check cmp.check
-endif
-
-clean:
-
-.PHONY: all check clean test
diff --git a/tests/lddtree/meson.build b/tests/lddtree/meson.build
new file mode 100644
index 0000000..256998e
--- /dev/null
+++ b/tests/lddtree/meson.build
@@ -0,0 +1,10 @@
+foreach sfx : ['sh', 'py', 'cmp']
+ test('lddtree-' + sfx, files('dotest-' + sfx),
+ workdir : meson.current_source_dir(),
+ env : {
+ 'builddir' : meson.project_build_root(),
+ 'srcdir' : meson.project_source_root(),
+ 'current_srcdir' : meson.current_source_dir(),
+ }
+ )
+endforeach
diff --git a/tests/lib.sh b/tests/lib.sh
index 03d9f2a..0dab3fa 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -1,19 +1,8 @@
-if [[ -z ${abs_top_builddir} ]] ; then
- srcdir=$(cd "${0%/*}" && pwd)
- top_srcdir=$(cd "${srcdir}/../.." && pwd)
- builddir=${srcdir}
- top_builddir=${top_srcdir}
-else
- mkdir -p "${builddir}"
- top_srcdir=${abs_top_srcdir}
- top_builddir=${abs_top_builddir}
-fi
-
GOOD=$'\e[32;1m'
BAD=$'\e[31;1m'
NORMAL=$'\e[m'
-PATH="${top_srcdir}:${top_builddir}:${PATH}"
+PATH="$(realpath "${srcdir}" "${builddir}" | tr '\n' ':'):${PATH}"
unset ROOT # who knows!
ret=0
diff --git a/tests/scanelf/Makefile b/tests/scanelf/Makefile
deleted file mode 100644
index 62084f0..0000000
--- a/tests/scanelf/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all: check
-
-test check:
- ./dotest
-
-clean:
-
-.PHONY: all check clean test
diff --git a/tests/scanelf/dotest b/tests/scanelf/dotest
index d06f086..fdfd2a2 100755
--- a/tests/scanelf/dotest
+++ b/tests/scanelf/dotest
@@ -5,9 +5,9 @@
#
# simple scanelf symbol checks
#
-scanelf -qsmain -F'%s %f' "${top_builddir}"/scanelf \
- > "${builddir}"/scanelf.simple
-testit scanelf.simple{,.good}
+${MESON_EXE_WRAPPER} "${builddir}/scanelf" -qsmain -F'%s %f' \
+ "${builddir}"/scanelf > "${builddir}"/scanelf.simple
+testit scanelf.simple tests/scanelf/scanelf.simple.good
diff --git a/tests/scanelf/meson.build b/tests/scanelf/meson.build
new file mode 100644
index 0000000..af632fd
--- /dev/null
+++ b/tests/scanelf/meson.build
@@ -0,0 +1,8 @@
+test('scanelf-test', files('dotest'),
+ workdir : meson.current_source_dir(),
+ env : {
+ 'builddir' : meson.project_build_root(),
+ 'srcdir' : meson.project_source_root(),
+ 'current_srcdir' : meson.current_source_dir(),
+ }
+)
diff --git a/tests/source/Makefile b/tests/source/Makefile
deleted file mode 100644
index 62084f0..0000000
--- a/tests/source/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all: check
-
-test check:
- ./dotest
-
-clean:
-
-.PHONY: all check clean test
diff --git a/tests/source/dotest b/tests/source/dotest
index 4cbb54a..c97e8cb 100755
--- a/tests/source/dotest
+++ b/tests/source/dotest
@@ -9,35 +9,6 @@ findfiles() {
}
#
-# check for misc common typos
-#
-find "${top_srcdir}" \
- '(' -type d -a '(' -name .git -o -name tests ')' -prune ')' \
- -o '(' -type f -a -print0 ')' | xargs -0 \
- grep -n -I \
- -e '\<compatability\>' \
- -e '\<compatable\>' \
- -e '\<fordeground\>' \
- -e '\<depency\>' \
- -e '\<defalt\>' \
- -e '\<remaing\>' \
- -e '\<queuing\>' \
- -e '\<detatch\>' \
- -e '\<sempahore\>' \
- -e '\<reprenstative\>' \
- -e '\<overriden\>' \
- -e '\<readed\>' \
- -e '\<formated\>' \
- -e '\<algorithic\>' \
- -e '\<deamon\>' \
- -e '\<derefernce\>' \
- -e '\<lenght\>' \
- | sed -e "s:^\.\./\.\./::g" > "${builddir}"/src.typos
-testit src.typos
-
-
-
-#
# don't allow obsolete functions
#
findfiles | xargs -0 \
diff --git a/tests/source/meson.build b/tests/source/meson.build
new file mode 100644
index 0000000..f435679
--- /dev/null
+++ b/tests/source/meson.build
@@ -0,0 +1,8 @@
+test('source tests', files('dotest'),
+ workdir : meson.current_source_dir(),
+ env : {
+ 'builddir' : meson.project_build_root(),
+ 'srcdir' : meson.project_source_root(),
+ 'current_srcdir' : meson.current_source_dir(),
+ }
+)