commit:     c73ba1a6e8713f267be8c5083541619753993515
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri May 18 18:27:06 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri May 18 18:27:06 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c73ba1a6

tests/atom_explode: use pre-build files to allow running

Make this test run on platforms with a different portdir, or without
Portage (such as Travis).  This should avoid regressions like bug #567336

 tests/atom_explode/atom-explode.py |   2 +-
 tests/atom_explode/dotest          |  30 +++++++++++++++++-------------
 tests/atom_explode/ebuildlist.xz   | Bin 0 -> 298948 bytes
 tests/atom_explode/portageatoms.xz | Bin 0 -> 728208 bytes
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/tests/atom_explode/atom-explode.py 
b/tests/atom_explode/atom-explode.py
index 972bac7..3168c7e 100755
--- a/tests/atom_explode/atom-explode.py
+++ b/tests/atom_explode/atom-explode.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 import sys,portage
 

diff --git a/tests/atom_explode/dotest b/tests/atom_explode/dotest
index 3fe7086..e911ab5 100755
--- a/tests/atom_explode/dotest
+++ b/tests/atom_explode/dotest
@@ -3,26 +3,30 @@
 . ../init.sh || exit 1
 
 PORTDIR=$(DEBUG=: q -Ch 2>&1 | grep ^PORTDIR | awk '{print $NF}')
-pushd "${PORTDIR}"/metadata/md5-cache >/dev/null || { echo SKIPPED; exit 0 ; }
-
-if [[ $1 == -v ]] ; then
-       find . -mindepth 2 -type f -printf '%P\n%f\n' | while read line ; do
-               echo "TESTING $line: "
-               "$b"/e "${line}"
-       done
-       exit 0
+if [[ -d "${PORTDIR}"/metadata/md5-cache ]] ; then
+       pushd "${PORTDIR}"/metadata/md5-cache >/dev/null || exit $?
+
+       if [[ $1 == -v ]] ; then
+               find . -mindepth 2 -type f -printf '%P\n%f\n' | while read line 
; do
+                       echo "TESTING $line: "
+                       "$b"/e "${line}"
+               done
+               exit 0
+       fi
+
+       # split the disk i/o out so both tests are CPU bound only
+       files=$(find . -mindepth 2 -type f ! -name "Manifest.*" -printf 
'%P\n%f\n')
+       popd >/dev/null
+else
+       files=$(xzcat ebuildlist.xz)
 fi
 
-# split the disk i/o out so both tests are CPU bound only
-files=$(find . -mindepth 2 -type f ! -name "Manifest.*" -printf '%P\n%f\n')
-popd >/dev/null
-
 printf "atom_explode():"
 time echo "${files}" | "$b"/e > "$b"/me || exit $?
 echo
 
 printf "portage:"
-time echo "${files}" | "$s"/atom-explode.py > "$b"/py || exit $?
+time echo "${files}" | "$s"/atom-explode.py > "$b"/py || xzcat portageatoms.xz 
> "$b"/py
 echo
 
 diff -U 0 "$b"/me "$b"/py

diff --git a/tests/atom_explode/ebuildlist.xz b/tests/atom_explode/ebuildlist.xz
new file mode 100644
index 0000000..6c7148f
Binary files /dev/null and b/tests/atom_explode/ebuildlist.xz differ

diff --git a/tests/atom_explode/portageatoms.xz 
b/tests/atom_explode/portageatoms.xz
new file mode 100644
index 0000000..e7b062a
Binary files /dev/null and b/tests/atom_explode/portageatoms.xz differ

Reply via email to