[gentoo-commits] proj/pax-utils:master commit in: /, tests/pspax/
commit: 66417851bbfc2266513774e59aa32b36469a756b Author: Mathias Krause grsecurity net> AuthorDate: Tue Jan 23 11:17:18 2024 + Commit: Mike Gilbert gentoo org> CommitDate: Mon Jul 22 21:06:05 2024 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=66417851 tests: add basic pspax test Add a basic test that simply makes sure pspax executes just fine, i.e. doesn't get killed by the seccomp policy. Signed-off-by: Mathias Krause grsecurity.net> Signed-off-by: Mike Gilbert gentoo.org> meson.build | 1 + tests/pspax/dotest | 12 tests/pspax/meson.build | 8 3 files changed, 21 insertions(+) diff --git a/meson.build b/meson.build index 319e3de..64fcc14 100644 --- a/meson.build +++ b/meson.build @@ -140,6 +140,7 @@ meson.add_dist_script('meson-build-dist-man.sh') do_tests = get_option('tests') if do_tests subdir('tests/lddtree') + subdir('tests/pspax') subdir('tests/scanelf') subdir('tests/source') endif diff --git a/tests/pspax/dotest b/tests/pspax/dotest new file mode 100755 index 000..f2ccc98 --- /dev/null +++ b/tests/pspax/dotest @@ -0,0 +1,12 @@ +#!/bin/bash + +. "${0%/*}"/../lib.sh + +# +# simple pspax execution check +# +${MESON_EXE_WRAPPER} sh -c "${builddir}/pspax" >/dev/null \ + 2> "${builddir}"/pspax.err +testit pspax.err + +exit ${ret} diff --git a/tests/pspax/meson.build b/tests/pspax/meson.build new file mode 100644 index 000..a00a96d --- /dev/null +++ b/tests/pspax/meson.build @@ -0,0 +1,8 @@ +test('pspax-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(), + } +)
[gentoo-commits] proj/pax-utils:master commit in: tests/source/, /
commit: e679f9bd82197f0f1831a0a4a282851994aa172c Author: Mike Frysinger chromium org> AuthorDate: Wed Jan 24 15:32:52 2024 + Commit: Mike Frysinger gentoo org> CommitDate: Wed Jan 24 15:32:52 2024 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=e679f9bd build: use standard config.h naming Signed-off-by: Mike Frysinger chromium.org> Signed-off-by: Mike Frysinger gentoo.org> meson.build | 2 +- porting.h | 2 +- tests/source/dotest | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 255107b..c91bb64 100644 --- a/meson.build +++ b/meson.build @@ -56,7 +56,7 @@ foreach x : [ endforeach configure_file( - output : 'probes.h', + output : 'config.h', configuration : probe_results, ) diff --git a/porting.h b/porting.h index 61018fb..1ace55e 100644 --- a/porting.h +++ b/porting.h @@ -11,7 +11,7 @@ #ifndef _PORTING_H #define _PORTING_H -#include "probes.h" +#include "config.h" #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) diff --git a/tests/source/dotest b/tests/source/dotest index cc278a5..c97e8cb 100755 --- a/tests/source/dotest +++ b/tests/source/dotest @@ -5,7 +5,7 @@ findfiles() { find "${top_srcdir}" \ '(' -type d -a '(' -name .git -o -name autotools ')' -prune ')' \ - -o '(' '(' -name '*.[ch]' -a ! -name 'probes.h' ')' -print0 ')' + -o '(' '(' -name '*.[ch]' -a ! -name 'config.h' ')' -print0 ')' } #
[gentoo-commits] proj/pax-utils:master commit in: tests/source/, /
commit: 7b95b1831d71396150c5cb10d4edf899e135d068 Author: Arsen Arsenović aarsen me> AuthorDate: Fri Jun 24 14:03:46 2022 + Commit: Sam James gentoo org> CommitDate: Tue Jul 12 06:33:20 2022 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=7b95b183 Probe the target system for needed headers This prevents new or unconventional systems requiring upstream changes, though, this is not perfect, as it doesn't address some of the other defines related to OSes the preprocessor does (namely, wrt the ldso cache handling). I didn't touch these yet as I took a more conservative approach of (probably) not changing what happens at runtime. Signed-off-by: Arsen Arsenović aarsen.me> Signed-off-by: Sam James gentoo.org> porting.h | 25 +++-- tests/source/dotest | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/porting.h b/porting.h index 8e5542d..0d43a92 100644 --- a/porting.h +++ b/porting.h @@ -11,9 +11,7 @@ #ifndef _PORTING_H #define _PORTING_H -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "probes.h" #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) @@ -41,36 +39,36 @@ #include #include #include "elf.h" -#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) +#if HAS_ALLOCA_H # include #endif -#if defined(__linux__) +#if HAS_SYS_PRCTL_H # include -# if !defined(HAVE_CONFIG_H) || defined(HAVE_LINUX_SECCOMP_H) +# if HAS_LINUX_SECCOMP_H # include # endif -# if !defined(HAVE_CONFIG_H) || defined(HAVE_LINUX_SECUREBITS_H) +# if HAS_LINUX_SECUREBITS_H # include # endif #endif -#if defined(__GLIBC__) || defined(__UCLIBC__) || defined(__ANDROID__) +#if HAS_ENDIAN_H && HAS_BYTESWAP_H # include # include -#elif defined(__FreeBSD__) +#elif HAS_SYS_ENDIAN_H # include -#elif defined(__sun__) +#elif HAS_ISA_DEFS_H # include -#elif defined(__MACH__) +#elif HAS_MACHINE_ENDIAN_H # include #endif -#if defined(__GLIBC__) || defined(__UCLIBC__) || defined(__NetBSD__) +#ifdef HAS_GLOB_H # include #endif #if defined(__GLIBC__) || defined(__UCLIBC__) || defined(__NetBSD__) # define __PAX_UTILS_DEFAULT_LD_CACHE_CONFIG "/etc/ld.so.conf" -#elif defined(__FreeBSD__) || defined(__DragonFly__) +#elif HAS_ELF_HINTS_H # include # define __PAX_UTILS_DEFAULT_LD_CACHE_CONFIG _PATH_ELF_HINTS #else @@ -168,7 +166,6 @@ # define __PAX_UTILS_PATH_MAX PATH_MAX #endif -/* fall back case for non-Linux hosts ... so lame */ #if !defined(ELF_DATA) # if defined(BYTE_ORDER) # if BYTE_ORDER == LITTLE_ENDIAN diff --git a/tests/source/dotest b/tests/source/dotest index c97e8cb..cc278a5 100755 --- a/tests/source/dotest +++ b/tests/source/dotest @@ -5,7 +5,7 @@ findfiles() { find "${top_srcdir}" \ '(' -type d -a '(' -name .git -o -name autotools ')' -prune ')' \ - -o '(' '(' -name '*.[ch]' -a ! -name 'config.h' ')' -print0 ')' + -o '(' '(' -name '*.[ch]' -a ! -name 'probes.h' ')' -print0 ')' } #
[gentoo-commits] proj/pax-utils:master commit in: tests/lddtree/, tests/scanelf/, man/, tests/, tests/source/, /, ...
commit: 063fcaeaa05074a9d90acec2f68b25dfb8ecd279 Author: Arsen Arsenović aarsen me> AuthorDate: Fri Jun 24 08:19:20 2022 + Commit: Sam James gentoo org> CommitDate: Tue Jul 12 06:33:20 2022 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=063fcaea 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ć aarsen.me> Signed-off-by: Sam James gentoo.org> .depend | 18 -- .github/workflows/build-test-ci.yml | 74 +++- Makefile| 224 Makefile.am | 114 autogen.sh | 94 -- configure.ac| 72 make-seccomp-filters.sh | 13 ++ make-tarball.sh | 91 -- man/Makefile| 13 -- man/custom.xsl | 3 +- man/fragment/date | 0 man/fragment/version| 1 - man/meson.build | 37 man/{pax-utils.docbook => pax-utils.docbook.in} | 15 +- meson.build | 169 ++ meson_options.txt | 9 + paxinc.h| 3 + tests/Makefile | 10 -- tests/lddtree/Makefile | 13 -- tests/lddtree/meson.build | 10 ++ tests/lib.sh| 13 +- tests/scanelf/Makefile | 8 - tests/scanelf/dotest| 6 +- tests/scanelf/meson.build | 8 + tests/source/Makefile | 8 - tests/source/dotest | 29 --- tests/source/meson.build| 8 + version.h.in| 1 + 28 files changed, 295 insertions(+), 769 deletions(-) diff --git a/.depend b/.depend deleted file mode 100644 index aab4f89..000 --- a/.depend +++ /dev/null @@ -1,18 +0,0 @@ -paxelf.o: paxelf.c paxinc.h porting.h elf.h xfuncs.h security.h paxelf.h \ - macho.h paxmacho.h -paxmacho.o: paxmacho.c paxinc.h porting.h elf.h xfuncs.h security.h \ - paxelf.h macho.h paxmacho.h -paxinc.o: paxinc.c paxinc.h porting.h elf.h xfuncs.h security.h paxelf.h \ - macho.h paxmacho.h -security.o: security.c paxinc.h porting.h elf.h xfuncs.h security.h \ - paxelf.h macho.h paxmacho.h seccomp-bpf.h -xfuncs.o: xfuncs.c paxinc.h porting.h elf.h xfuncs.h security.h paxelf.h \ - macho.h paxmacho.h -scanelf.o: scanelf.c paxinc.h porting.h elf.h xfuncs.h security.h \ - paxelf.h macho.h paxmacho.h -dumpelf.o: dumpelf.c paxinc.h porting.h elf.h xfuncs.h security.h \ - paxelf.h macho.h paxmacho.h -pspax.o: pspax.c paxinc.h porting.h elf.h xfuncs.h security.h paxelf.h \ - macho.h paxmacho.h -scanmacho.o: scanmacho.c paxinc.h porting.h elf.h xfuncs.h security.h \ - paxelf.h macho.h paxmacho.h diff --git a/.github/workflows/build-test-ci.yml b/.github/workflows/build-test-ci.yml index 1b69cc6..04d6fc5 100644 --- a/.github/workflows/build-test-ci.yml +++ b/.github/workflows/build-test-ci.yml @@ -22,39 +22,23 @@ jobs: CC: ${{ matrix.cc }} steps: - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y python3-pyelftools + run: | +sudo apt-get update +sudo apt-get install -y python3-pyelftools python3-pip \ +libcap-dev libseccomp-dev ninja-build +sudo pip3 install meson - uses: actions/checkout@v2 -# Hack up the man pages as installing xmlto is very expensive. -# We'll test this in the autotools builder instead. -- name: Hack man pages - run: echo man/*.docbook | sed s:docbook:1:g | xargs touch -- run: make -- run: make check -- run: make install DESTDIR="${PWD}/root/" -- run: make debug -- run: make check - - autotools-distcheck-linux: -strategy: - matrix: -os: [ubuntu-latest] -cc: [gcc, clang] -runs-on: ${{ matrix.os }} -env: - CC: ${{ matrix.cc }} -steps: -- name: Install dependencies -
[gentoo-commits] proj/pax-utils:master commit in: /, tests/
commit: 75966274a95160cabba4534f47867be90648f066 Author: Mike Frysinger chromium org> AuthorDate: Mon Oct 4 21:51:13 2021 + Commit: Mike Frysinger gentoo org> CommitDate: Mon Oct 4 21:51:13 2021 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=75966274 build: drop external function.sh use We use very little from it anymore, and can easily inline the few things we want. This makes code work on non-Gentoo systems. Signed-off-by: Mike Frysinger gentoo.org> make-tarball.sh | 7 ++- tests/lib.sh| 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/make-tarball.sh b/make-tarball.sh index 3cd3219..231cb66 100755 --- a/make-tarball.sh +++ b/make-tarball.sh @@ -5,12 +5,9 @@ set -e -if ! . /etc/init.d/functions.sh 2>/dev/null ; then - einfo() { printf ' * %b\n' "$*"; } - eerror() { einfo "$@" 1>&2; } -fi +einfo() { printf ' * %b\n' "$*"; } +eerror() { einfo "$@" 1>&2; } die() { eerror "$@"; exit 1; } - v() { printf '\t%s\n' "$*"; "$@"; } : ${MAKE:=make} diff --git a/tests/lib.sh b/tests/lib.sh index 927e503..03d9f2a 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -9,7 +9,9 @@ else top_builddir=${abs_top_builddir} fi -[ -e /etc/init.d/functions.sh ] && source /etc/init.d/functions.sh +GOOD=$'\e[32;1m' +BAD=$'\e[31;1m' +NORMAL=$'\e[m' PATH="${top_srcdir}:${top_builddir}:${PATH}" unset ROOT # who knows!
[gentoo-commits] proj/pax-utils:master commit in: tests/lddtree/
commit: 0112fd358ae00b803bd339f5e02d7f9372b5e4ca Author: Mike Frysinger gentoo org> AuthorDate: Thu Feb 16 21:13:30 2017 + Commit: Mike Frysinger gentoo org> CommitDate: Thu Feb 16 21:13:30 2017 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=0112fd35 tests: rename files to avoid ".py" suffix on non-python files tests/lddtree/Makefile | 2 +- tests/lddtree/{dotest.cmp => dotest-cmp} | 0 tests/lddtree/dotest-py | 3 +++ tests/lddtree/{dotest.sfx => dotest-sfx} | 0 tests/lddtree/dotest-sh | 3 +++ tests/lddtree/dotest.py | 3 --- tests/lddtree/dotest.sh | 3 --- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/lddtree/Makefile b/tests/lddtree/Makefile index 8e07b6b..3a13e28 100644 --- a/tests/lddtree/Makefile +++ b/tests/lddtree/Makefile @@ -1,7 +1,7 @@ all: check %.check: - ./dotest.$(@:.check=) + ./dotest-$(@:.check=) test check: sh.check ifneq ($(USE_PYTHON),no) diff --git a/tests/lddtree/dotest.cmp b/tests/lddtree/dotest-cmp similarity index 100% rename from tests/lddtree/dotest.cmp rename to tests/lddtree/dotest-cmp diff --git a/tests/lddtree/dotest-py b/tests/lddtree/dotest-py new file mode 100755 index 000..1a0d7ff --- /dev/null +++ b/tests/lddtree/dotest-py @@ -0,0 +1,3 @@ +#!/bin/bash +sfx=${0##*-} +. ./dotest-sfx diff --git a/tests/lddtree/dotest.sfx b/tests/lddtree/dotest-sfx similarity index 100% rename from tests/lddtree/dotest.sfx rename to tests/lddtree/dotest-sfx diff --git a/tests/lddtree/dotest-sh b/tests/lddtree/dotest-sh new file mode 100755 index 000..1a0d7ff --- /dev/null +++ b/tests/lddtree/dotest-sh @@ -0,0 +1,3 @@ +#!/bin/bash +sfx=${0##*-} +. ./dotest-sfx diff --git a/tests/lddtree/dotest.py b/tests/lddtree/dotest.py deleted file mode 100755 index 69d782e..000 --- a/tests/lddtree/dotest.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -sfx=${0##*.} -. ./dotest.sfx diff --git a/tests/lddtree/dotest.sh b/tests/lddtree/dotest.sh deleted file mode 100755 index 69d782e..000 --- a/tests/lddtree/dotest.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -sfx=${0##*.} -. ./dotest.sfx
[gentoo-commits] proj/pax-utils:master commit in: tests/scanelf/, tests/, tests/source/, tests/lddtree/
commit: 706679c2071261848f964bb7b987de1bac466f46 Author: Mike Frysinger gentoo org> AuthorDate: Thu Dec 17 01:00:44 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Thu Dec 17 01:00:44 2015 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=706679c2 tests: add out-of-tree build support tests/Makefile | 4 +++- tests/lddtree/dotest.cmp | 20 ++-- tests/lddtree/dotest.sfx | 2 +- tests/lib.sh | 25 +++-- tests/scanelf/dotest | 2 +- tests/source/dotest | 26 +- 6 files changed, 47 insertions(+), 32 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 1db7654..f4b81e8 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,8 +1,10 @@ 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) +%_:; $(MAKE) -C $(_dir) $(_targ) srcdir=$(abs_top_srcdir)/tests/$(_dir) builddir=$(abs_top_builddir)/tests/$(_dir) diff --git a/tests/lddtree/dotest.cmp b/tests/lddtree/dotest.cmp index 2f04a55..89217fa 100755 --- a/tests/lddtree/dotest.cmp +++ b/tests/lddtree/dotest.cmp @@ -6,22 +6,30 @@ # make sure list output matches # for sfx in py sh ; do - lddtree.${sfx} -l /bin/bash > lddtree.${sfx}.list & + lddtree.${sfx} -l /bin/bash > "${builddir}"/lddtree.${sfx}.list & done wait -testit lddtree.*.list -rm -f lddtree.*.list +if diff -u "${builddir}"/lddtree.*.list ; then + pass "lddtree -l /bin/bash" +else + fail "lddtree -l /bin/bash" +fi +rm -f "${builddir}"/lddtree.*.list # # Same as above but with the -a flag # for sfx in py sh ; do - lddtree.${sfx} -l -a /bin/bash > lddtree.${sfx}.list-all & + lddtree.${sfx} -l -a /bin/bash > "${builddir}"/lddtree.${sfx}.list-all & done wait -testit lddtree.*.list-all -rm -f lddtree.*.list-all +if diff -u "${builddir}"/lddtree.*.list-all ; then + pass "lddtree -l -a /bin/bash" +else + fail "lddtree -l -a /bin/bash" +fi +rm -f "${builddir}"/lddtree.*.list-all exit ${ret} diff --git a/tests/lddtree/dotest.sfx b/tests/lddtree/dotest.sfx index 1490434..fa82fd0 100644 --- a/tests/lddtree/dotest.sfx +++ b/tests/lddtree/dotest.sfx @@ -6,7 +6,7 @@ # smoke tests of sorts # lddtree.${sfx} /bin/bash | \ - grep -i 'none' > lddtree.${sfx}.smoke + grep -i 'none' > "${builddir}"/lddtree.${sfx}.smoke testit lddtree.${sfx}.smoke diff --git a/tests/lib.sh b/tests/lib.sh index 93943a1..927e503 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -1,12 +1,17 @@ -# no out of tree building so shut it -srcdir=`cd "${0%/*}" && pwd` -top_srcdir=`cd "${srcdir}/../.." && pwd` -builddir=${srcdir} -top_builddir=${top_srcdir} +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 [ -e /etc/init.d/functions.sh ] && source /etc/init.d/functions.sh -PATH=${top_builddir}:${PATH} +PATH="${top_srcdir}:${top_builddir}:${PATH}" unset ROOT # who knows! ret=0 @@ -24,13 +29,13 @@ testit() { local tret=0 err case $# in 1) - if [[ -s $1 ]] ; then + if [[ -s ${builddir}/$1 ]] ; then tret=1 - err=$(<"$1") + err=$(<"${builddir}/$1") fi ;; 2) - if ! err=$(diff -u "$1" "$2") ; then + if ! err=$(diff -u "${builddir}/$1" "${srcdir}/$2") ; then tret=1 fi esac @@ -40,5 +45,5 @@ testit() { fail "$1" echo "${err}" fi - rm -f "$1" + rm -f "${builddir}/$1" } diff --git a/tests/scanelf/dotest b/tests/scanelf/dotest index 19293f9..d06f086 100755 --- a/tests/scanelf/dotest +++ b/tests/scanelf/dotest @@ -6,7 +6,7 @@ # simple scanelf symbol checks # scanelf -qsmain -F'%s %f' "${top_builddir}"/scanelf \ - > scanelf.simple + > "${builddir}"/scanelf.simple testit scanelf.simple{,.good} diff --git a/tests/source/dotest b/tests/source/dotest index 16297e2..4cbb54a 100755 --- a/tests/source/dotest +++ b/tests/source/dotest @@ -32,7 +32,7 @@ find "${top_srcdir}" \ -e '\' \ -e '\' \ -e '\' \ - | sed -e "s:^\.\./\.\./::g" > src.typos + | sed -e "s:^\.\./\.\./::g" > "${builddir}"/src.typos testit src.typos @@ -42,7 +42,7 @@ testit src.typos # findfiles | xargs -0 \ grep -n -E -e
[gentoo-commits] proj/pax-utils:master commit in: /, tests/lddtree/
commit: 26ee546756ce9e1bb84951bc5cfac3cdde87a2d1 Author: Mike Frysinger gentoo org> AuthorDate: Mon Jul 20 04:03:22 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Mon Jul 20 04:03:22 2015 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=26ee5467 lddtree: handle direct ldso linkage better If the ELF we're showing is linked directly against the ELF which is used as the ELF interp (i.e. the ldso), make sure we don't list it twice. We want to see it "twice" in the pretty form: $ ./lddtree.py /bin/bash /bin/bash (interpreter => /lib/ld-linux-armhf.so.3) <= here libreadline.so.6 => /lib/libreadline.so.6 libncurses.so.5 => /lib/libncurses.so.5 libc.so.6 => /lib/libc.so.6 ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 <= here But not in the list form (as that is used by scripts): $ ./lddtree.py -l /bin/bash /bin/bash /lib/ld-linux-armhf.so.3 <= only here /lib/libreadline.so.6 /lib/libncurses.so.5 /lib/libc.so.6 We also reconcile a few differences wrt interp display and the sh/py implementations. Reported-by: Tomasz Buchert debian.org> lddtree.py | 13 +++-- lddtree.sh | 11 +-- tests/lddtree/dotest.cmp | 10 ++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lddtree.py b/lddtree.py index 645cfd1..9330295 100755 --- a/lddtree.py +++ b/lddtree.py @@ -510,17 +510,26 @@ def _ActionShow(options, elf): chain_libs.pop() shown_libs = set(elf['needed']) + new_libs = elf['needed'][:] chain_libs = [] interp = elf['interp'] if interp: -shown_libs.add(os.path.basename(interp)) +lib = os.path.basename(interp) +shown_libs.add(lib) +# If we are in non-list mode, then we want to show the "duplicate" interp +# lines -- first the header (interp=>xxx), and then the DT_NEEDED line to +# show that the ELF is directly linked against the interp. +# If we're in list mode though, we only want to show the interp once. +# Unless of course we have the --all flag active, then we show everything. +if not options.all and options.list and lib in new_libs: + new_libs.remove(lib) if options.list: print(elf['path']) if not interp is None: print(interp) else: print('%s (interpreter => %s)' % (elf['path'], interp)) - for lib in elf['needed']: + for lib in new_libs: _show(lib, 1) diff --git a/lddtree.sh b/lddtree.sh index a37d499..07be7ab 100755 --- a/lddtree.sh +++ b/lddtree.sh @@ -160,6 +160,11 @@ show_elf() { ) fi interp=${interp##*/} + # If we are in non-list mode, then we want to show the "duplicate" interp + # lines -- first the header (interp=>xxx), and then the DT_NEEDED line to + # show that the ELF is directly linked against the interp. + # If we're in list mode though, we only want to show the interp once. + ${LIST} && allhits+=",${interp}" fi ${LIST} || printf "\n" @@ -170,12 +175,14 @@ show_elf() { local my_allhits if ! ${SHOW_ALL} ; then my_allhits="${allhits}" - allhits="${allhits},${interp},${libs}" + allhits+=",${libs}" fi for lib in ${libs//,/ } ; do lib=${lib##*/} - [[ ,${my_allhits}, == *,${lib},* ]] && continue + # No need for leading comma w/my_allhits as we guarantee it always + # starts with one due to the way we append the value above. + [[ ${my_allhits}, == *,${lib},* ]] && continue find_elf "${lib}" "${resolved}" rlib=${_find_elf} show_elf "${rlib:-${lib}}" $((indent + 4)) "${parent_elfs}" diff --git a/tests/lddtree/dotest.cmp b/tests/lddtree/dotest.cmp index d8992f3..2f04a55 100755 --- a/tests/lddtree/dotest.cmp +++ b/tests/lddtree/dotest.cmp @@ -13,5 +13,15 @@ testit lddtree.*.list rm -f lddtree.*.list +# +# Same as above but with the -a flag +# +for sfx in py sh ; do + lddtree.${sfx} -l -a /bin/bash > lddtree.${sfx}.list-all & +done +wait +testit lddtree.*.list-all +rm -f lddtree.*.list-all + exit ${ret}
[gentoo-commits] proj/pax-utils:master commit in: tests/
commit: d40c49ba860483959dea26c38df0fa5a326c2aca Author: Mike Frysinger gentoo org> AuthorDate: Sat Mar 14 05:53:30 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Sat Mar 14 05:53:30 2015 + URL:https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=d40c49ba tests: clean up a bit The functions.sh messes with PATH, so mangle it after we load it. Pull out pass/fail so tests can use it directly. Clean up the style of testit to be more bashy and safe (quotes). tests/lib.sh | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/lib.sh b/tests/lib.sh index 20f67bd..93943a1 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -4,33 +4,41 @@ top_srcdir=`cd "${srcdir}/../.." && pwd` builddir=${srcdir} top_builddir=${top_srcdir} +[ -e /etc/init.d/functions.sh ] && source /etc/init.d/functions.sh + PATH=${top_builddir}:${PATH} unset ROOT # who knows! -[ -e /etc/init.d/functions.sh ] && source /etc/init.d/functions.sh - ret=0 +pass() { + echo "${GOOD}PASS${NORMAL}: $*" +} + +fail() { + ret=1 + echo "${BAD}FAIL${NORMAL}: $*" >&2 +} + testit() { local tret=0 err case $# in - 1) - if [ -s $1 ] ; then - tret=1 - err=$(<$1) - fi - ;; - 2) - if ! err=`diff -u $1 $2` ; then - tret=1 - fi + 1) + if [[ -s $1 ]] ; then + tret=1 + err=$(<"$1") + fi + ;; + 2) + if ! err=$(diff -u "$1" "$2") ; then + tret=1 + fi esac - if [ ${tret} -eq 0 ] ; then - echo ${GOOD}PASS${NORMAL}: $1 + if [[ ${tret} -eq 0 ]] ; then + pass "$1" else - ret=1 - echo ${BAD}FAIL${NORMAL}: $1 + fail "$1" echo "${err}" fi - rm -f $1 + rm -f "$1" }
[gentoo-commits] proj/pax-utils:master commit in: /, tests/source/, man/fragment/
commit: 10c47816af92c613d67bb717286f3f8397d96c43 Author: Mike Frysinger gentoo org> AuthorDate: Mon Mar 2 09:32:07 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Mon Mar 2 09:32:07 2015 + URL: http://sources.gentoo.org/gitweb/?p=proj/pax-utils.git;a=commit;h=10c47816 migrate to git --- .cvsignore | 43 -- .gitignore | 2 -- Makefile | 35 +++- Makefile.am | 12 - README | 6 ++--- dumpelf.c| 6 ++--- lddtree.py | 4 +-- lddtree.sh | 5 +--- macho.h | 1 - make-tarball.sh | 75 man/fragment/version | 2 +- paxelf.c | 1 - paxelf.h | 1 - paxinc.c | 1 - paxinc.h | 6 +++-- paxmacho.c | 1 - paxmacho.h | 1 - porting.h| 1 - pspax.c | 5 ++-- scanelf.c| 6 ++--- scanmacho.c | 6 ++--- tests/source/dotest | 4 +-- xfuncs.c | 1 - xfuncs.h | 1 - 24 files changed, 104 insertions(+), 122 deletions(-) diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index a121e02..000 --- a/.cvsignore +++ /dev/null @@ -1,43 +0,0 @@ -*bz2 -*~ -*.[adio] -*.l[ao] -*.gdb -*.pyc -*.deps -*.libs - -*.patch -*.orig -*.rej -*.diff -pax-utils-* -contrib - -a.out* -lib*.so* -core -.gdb_history -.gdbinit - -aclocal.m4 -autom4te.cache -build -config.cache -config.h -config.h.in -config.log -config.status -configure -autotools -libtool -Makefile.in -stamp-h1 - -dumpelf -pspax -scanelf -scanmacho - -.git -*.x diff --git a/.gitignore b/.gitignore index 394adca..4e0d5fa 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,3 @@ stamp-h1 /scanmacho /man/*.1 - -CVS diff --git a/Makefile b/Makefile index 2f9e60b..8048d58 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # Copyright 2003-2006 Ned Ludd # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.88 2015/02/28 22:49:13 vapier Exp $ check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ @@ -48,7 +47,10 @@ endif ifdef PV override CPPFLAGS += -DVERSION=\"$(PV)\" +else +VCSID := $(shell git describe --tags HEAD) endif +override CPPFLAGS += -DVCSID='"$(VCSID)"' ELF_TARGETS = scanelf dumpelf $(shell echo | $(CC) -dM -E - | grep -q __svr4__ || echo pspax) @@ -131,32 +133,13 @@ endif PN = pax-utils P = $(PN)-$(PV) dist: - @if [ "$(PV)" = "" ] ; then \ - echo "Please run 'make dist PV='" ; \ - exit 1 ; \ - fi + ./make-tarball.sh $(PV) +distcheck: dist rm -rf $(P) - mkdir $(P) - cp -a CVS $(P)/ - cd $(P) && cvs up - echo "$(PV)" > $(P)/man/fragment/version - $(MAKE) -C $(P)/man - sed -i '/AC_INIT/s:git:$(PV):' $(P)/configure.ac - $(MAKE) -C $(P) autotools - tar cf - $(P) --exclude=CVS --exclude=.cvsignore | xz > $(P).tar.xz - @printf "\n . Making sure clean cvs build works . \n\n" - set -e; \ - unset CFLAGS; \ - for t in all check clean debug check clean; do \ - $(MAKE) -C $(P) $$t; \ - done; \ - cd $(P); \ - ./configure -C; \ - for t in all check; do \ - $(MAKE) $$t; \ - done + tar xf $(P).tar.xz + $(MAKE) -C $(P) + $(MAKE) -C $(P) check rm -rf $(P) - du -b $(P).tar.xz -include .depend @@ -171,7 +154,7 @@ check test: GEN_MARK_START = \# @@@ GEN START @@@ \# GEN_MARK_END = \# @@@ GEN START @@@ \# EXTRA_DIST = \ - $(shell find '(' -name CVS -prune ')' -o '(' -type f -print ')') + $(shell find -type f) MAKE_MULTI_LINES = $(patsubst %,\n\t%,$(sort $(1))) # 2nd level of indirection here is so the $(find) doesn't pick up # files in EXTRA_DIST that get cleaned up ... diff --git a/Makefile.am b/Makefile.am index bcb7462..9f51139 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,28 +44,16 @@ EXTRA_DIST = autotools/m4/gnulib-cache.m4 # @@@ GEN START @@@ # dist_man_MANS += EXTRA_DIST += \ - tests/CVS/Entries \ - tests/CVS/Repository \ - tests/CVS/Root \ tests/Makefile \ - tests/lddtree/CVS/Entries \ - tests/lddtree/CVS/Repository \ - tests/lddtree/CVS/Root \ tests/lddtree/Makefile \ tests/lddtree/dotest.cmp \ tests/lddtree/dotest.py \ tests/lddtree/dotest.sfx \ tests/lddtree/dotest.sh \ tests/lib.sh \ - tests/scanelf/CVS/Entries \ - tests/scanelf/CVS/Repository \ - tests/scanelf/CVS/Root \ tests/scanelf/Makefile \ tests/scanelf/do