summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2017-04-15 16:30:41 +0200
committerPierre Schmitz <pierre@archlinux.de>2017-04-15 16:30:41 +0200
commit355b457c97a55c9ee16ef2f81fc06d49c47c129b (patch)
tree42938f6118a904bbefbe82c7a520fa7e80eb5cfb
parentabe255d51bc450ee9c0ac1a4486b4d7d10c9794f (diff)
Compile tests into one file to reduce time spent on setup
-rwxr-xr-xtest/runTest23
-rwxr-xr-xtest/test.d/create-filelists.sh7
-rwxr-xr-xtest/test.d/db-move.sh7
-rwxr-xr-xtest/test.d/db-remove.sh7
-rwxr-xr-xtest/test.d/db-repo-add.sh7
-rwxr-xr-xtest/test.d/db-repo-remove.sh7
-rwxr-xr-xtest/test.d/db-update.sh7
-rwxr-xr-xtest/test.d/ftpdir-cleanup.sh7
-rwxr-xr-xtest/test.d/packages.sh7
-rwxr-xr-xtest/test.d/signed-packages.sh7
-rwxr-xr-xtest/test.d/sourceballs.sh7
-rwxr-xr-xtest/test.d/testing2x.sh7
12 files changed, 10 insertions, 90 deletions
diff --git a/test/runTest b/test/runTest
index b8713d8..adeb84e 100755
--- a/test/runTest
+++ b/test/runTest
@@ -1,15 +1,12 @@
#!/bin/bash
-. "$(dirname ${BASH_SOURCE[0]})/lib/common.inc"
-
-for t in "$(dirname ${BASH_SOURCE[0]})/test.d/"*.sh; do
- l=$(basename ${t} .sh)
- if [ -x ${t} ]; then
- msg "Running test '${l}'"
- ${t}
- [ $? -ne 0 ] && die "Test '${l}' failed"
- echo -e "\n\n\n"
- else
- warning "Skipping test ${l}"
- fi
-done
+curdir=$(readlink -e $(dirname $0))
+
+testSuite=$(mktemp)
+trap "rm -rf '${testSuite}'" EXIT
+
+echo ". ${curdir}/lib/common.inc" > ${testSuite}
+cat "${curdir}/test.d"/*.sh >> ${testSuite}
+echo ". ${curdir}/lib/shunit2" >> ${testSuite}
+
+bash ${testSuite}
diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh
index 49734c4..0010bf3 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testCreateSimpleFileLists() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
@@ -101,5 +96,3 @@ testCleanupFileLists() {
done
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-move.sh b/test/test.d/db-move.sh
index 890ffc4..a27dfbb 100755
--- a/test/test.d/db-move.sh
+++ b/test/test.d/db-move.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testMoveSimplePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b')
@@ -118,5 +113,3 @@ testMoveSplitPackages() {
checkRemovedAnyPackage testing pkg-split-a
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index 416e693..52b9584 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testRemovePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-split-a' 'pkg-split-b' 'pkg-simple-epoch')
@@ -73,5 +68,3 @@ testRemoveAnyPackages() {
checkRemovedAnyPackage extra ${pkgbase}
done
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh
index 8603104..90e619b 100755
--- a/test/test.d/db-repo-add.sh
+++ b/test/test.d/db-repo-add.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testAddSimplePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b')
@@ -50,5 +45,3 @@ testAddMultiplePackages() {
done
done
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-repo-remove.sh b/test/test.d/db-repo-remove.sh
index 315d63d..0f294b5 100755
--- a/test/test.d/db-repo-remove.sh
+++ b/test/test.d/db-repo-remove.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testRemovePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
@@ -54,5 +49,3 @@ testRemoveMultiplePackages() {
done
done
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 7ae7a06..f9e7d1a 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testAddSimplePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b')
@@ -171,5 +166,3 @@ testUnknownRepo() {
[ -e "${FTP_BASE}/unknown" ] && fail "db-update pushed a package into an unknown repository"
rm -rf "${STAGING}/unknown/"
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh
index bfea7ea..73779a2 100755
--- a/test/test.d/ftpdir-cleanup.sh
+++ b/test/test.d/ftpdir-cleanup.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testCleanupSimplePackages() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b')
@@ -117,5 +112,3 @@ testCleanupSplitPackages() {
done
done
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/packages.sh b/test/test.d/packages.sh
index 488cb15..a5e432c 100755
--- a/test/test.d/packages.sh
+++ b/test/test.d/packages.sh
@@ -1,11 +1,4 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testPackages() {
# TODO: namcap -r sodepends fails with i686 packages
find "${pkgdir}" -name "*${PKGEXT}" -exec namcap -e sodepends,pkgnameindesc {} + || fail 'namcap failed'
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/signed-packages.sh b/test/test.d/signed-packages.sh
index 03566ef..148929f 100755
--- a/test/test.d/signed-packages.sh
+++ b/test/test.d/signed-packages.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testAddSignedPackage() {
releasePackage extra 'pkg-simple-a' 'i686'
../db-update || fail "db-update failed!"
@@ -32,5 +27,3 @@ testAddBrokenSignature() {
done
../db-update >/dev/null 2>&1 && fail "db-update should fail when a signature is broken!"
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh
index fdcf08c..a004cdb 100755
--- a/test/test.d/sourceballs.sh
+++ b/test/test.d/sourceballs.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testSourceballs() {
local arches=('i686' 'x86_64')
local pkgs=('pkg-simple-a' 'pkg-simple-b' 'pkg-simple-epoch')
@@ -80,5 +75,3 @@ testSourceballsCleanup() {
[ -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-a-*${SRCEXT} ] && fail "source package was not removed!"
[ ! -r ${FTP_BASE}/${SRCPOOL}/pkg-simple-b-*${SRCEXT} ] && fail "source package not found!"
}
-
-. "${curdir}/../lib/shunit2"
diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh
index fdc7ca3..8fac2ad 100755
--- a/test/test.d/testing2x.sh
+++ b/test/test.d/testing2x.sh
@@ -1,8 +1,3 @@
-#!/bin/bash
-
-curdir=$(readlink -e $(dirname $0))
-. "${curdir}/../lib/common.inc"
-
testTesting2xAnyPackage() {
releasePackage core pkg-any-a any
../db-update
@@ -23,5 +18,3 @@ testTesting2xAnyPackage() {
checkAnyPackage core pkg-any-a-1-2-any.pkg.tar.xz any
checkRemovedAnyPackage testing pkg-any-a
}
-
-. "${curdir}/../lib/shunit2"