at 18.09-beta 157 lines 6.4 kB view raw
1--- a/tests/libtest.sh 2+++ b/tests/libtest.sh 3@@ -315,7 +315,7 @@ 4 # running installed-tests: assume we know what we're doing 5 : 6 elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \ 7- --ro-bind / / /bin/true > bwrap-result 2>&1; then 8+ --ro-bind / / @coreutils@/bin/true > bwrap-result 2>&1; then 9 sed -e 's/^/# /' < bwrap-result 10 echo "1..0 # SKIP Cannot run bwrap" 11 exit 0 12@@ -323,7 +323,7 @@ 13 } 14 15 skip_without_python2 () { 16- if ! test -f /usr/bin/python2 || ! /usr/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then 17+ if ! test -f @python2@/bin/python2 || ! @python2@/bin/python2 -c "import sys; sys.exit(0 if sys.version_info >= (2, 7) else 1)" ; then 18 echo "1..0 # SKIP this test requires /usr/bin/python2 (2.7) support" 19 exit 0 20 fi 21@@ -335,12 +335,12 @@ 22 export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)" 23 DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)" 24 25-if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then 26+if ! @coreutils@/bin/kill -0 "$DBUS_SESSION_BUS_PID"; then 27 assert_not_reached "Failed to start dbus-daemon" 28 fi 29 30 cleanup () { 31- /bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} 32+ @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} 33 gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true 34 fusermount -u $XDG_RUNTIME_DIR/doc || : 35 if test -n "${TEST_SKIP_CLEANUP:-}"; then 36--- a/tests/make-test-runtime.sh 37+++ b/tests/make-test-runtime.sh 38@@ -26,6 +26,7 @@ 39 PATH="$PATH:/usr/sbin:/sbin" 40 41 # Add bash and dependencies 42+mkdir -p ${DIR}/nix/store 43 mkdir -p ${DIR}/usr/bin 44 mkdir -p ${DIR}/usr/lib 45 ln -s ../lib ${DIR}/usr/lib64 46@@ -35,73 +36,27 @@ 47 else 48 cp `which ldconfig` ${DIR}/usr/bin 49 fi 50-LIBS=`mktemp` 51-BINS=`mktemp` 52- 53-add_bin() { 54- local f=$1 55- shift 56- 57- if grep -qFe "${f}" $BINS; then 58- # Already handled 59- return 0 60- fi 61- 62- echo $f >> $BINS 63- 64- # Add library dependencies 65- (ldd "${f}" | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -) || true 66- 67- local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}") 68- if [ x$shebang != x ]; then 69- add_bin "$shebang" 70- fi 71-} 72- 73 for i in $@; do 74- I=`which $i` 75- add_bin $I 76- if test $i == python2; then 77- mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload 78- # This is a hardcoded minimal set of modules we need in the current tests. 79- # Pretty hacky stuff. Add modules as needed. 80- PYDIR=/usr/lib/python2.7 81- if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi 82- for py in site os stat posixpath genericpath warnings \ 83- linecache types UserDict abc _abcoll \ 84- _weakrefset copy_reg traceback sysconfig \ 85- re sre_compile sre_parse sre_constants \ 86- _sysconfigdata ; do 87- cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7 88- done 89- # These might not exist, depending how Python was configured; and the 90- # part after ${so} might be "module" or ".x86_64-linux-gnu" or 91- # something else 92- for so in _locale strop ; do 93- cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || : 94- done 95- for plat in $( cd ${PYDIR} && echo plat-* ); do 96- test -e ${PYDIR}/${plat} || continue 97- mkdir -p ${DIR}/usr/lib/python2.7/${plat} 98- cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/ 99- done 100- fi 101-done 102-for i in `cat $BINS`; do 103- echo Adding binary $i 1>&2 104- cp "$i" ${DIR}/usr/bin/ 105-done 106-for i in `cat $LIBS`; do 107- echo Adding library $i 1>&2 108- cp "$i" ${DIR}/usr/lib/ 109+ I=$(readlink -f $(which $i)) 110+ requisites=$(nix-store --query --requisites "$I") 111+ for r in $requisites; do 112+ # a single store item can be needed by multiple paths, no need to copy it again 113+ if [ ! -e ${DIR}/$r ]; then 114+ cp -r $r ${DIR}/$r 115+ fi 116+ done 117+ ln -s $I ${DIR}/usr/bin/$i 118 done 119 ln -s bash ${DIR}/usr/bin/sh 120 121-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but 122-# the real en_US locale is often not available, because its in the 123-# local archive. 124+mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store 125+chmod -R u+w ${DIR} # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed 126+find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths 127+find ${DIR} -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets 128+ 129+# We copy the whole locale archive because we do not have C.UTF8 locale 130 mkdir -p ${DIR}/usr/lib/locale/ 131-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US 132+cp @glibcLocales@/lib/locale/locale-archive ${DIR}/usr/lib/locale/locale-archive 133 134 if [ x$COLLECTION_ID != x ]; then 135 collection_args=--collection-id=${COLLECTION_ID} 136--- a/tests/testlibrary.c 137+++ b/tests/testlibrary.c 138@@ -584,7 +584,7 @@ 139 { 140 gint exit_code = 0; 141 char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net", 142- "--unshare-pid", "--ro-bind", "/", "/", "/bin/true", NULL }; 143+ "--unshare-pid", "--ro-bind", "/", "/", "@coreutils@/bin/true", NULL }; 144 g_autofree char *argv_str = g_strjoinv (" ", argv); 145 g_test_message ("Spawning %s", argv_str); 146 g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error); 147--- a/triggers/gtk-icon-cache.trigger 148+++ b/triggers/gtk-icon-cache.trigger 149@@ -1,7 +1,7 @@ 150 #!/bin/sh 151 152 if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then 153- cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ 154+ cp @hicolorIconTheme@/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ 155 for dir in $1/exports/share/icons/*; do 156 if test -f $dir/index.theme; then 157 if ! gtk-update-icon-cache --quiet $dir; then