summaryrefslogtreecommitdiffstats
path: root/test/test_sadt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:36:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:36:25 +0000
commit6077d258b500b20e1e705f5cda567400240c7804 (patch)
treea5d41c050bd69f91476994b0d30c0a8f1e7957b5 /test/test_sadt
parentInitial commit. (diff)
downloaddevscripts-6077d258b500b20e1e705f5cda567400240c7804.tar.xz
devscripts-6077d258b500b20e1e705f5cda567400240c7804.zip
Adding upstream version 2.21.3+deb11u1.upstream/2.21.3+deb11u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtest/test_sadt100
1 files changed, 100 insertions, 0 deletions
diff --git a/test/test_sadt b/test/test_sadt
new file mode 100755
index 0000000..0292d20
--- /dev/null
+++ b/test/test_sadt
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+# Copyright (C) 2018, Antonio Terceiro <terceiro@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -u
+
+. ${0%/*}/test_helper.sh
+
+if test "${1:-}" = --installed; then
+ sadt="sadt"
+ shift
+else
+ sadt="$(readlink -f "${0%/*}/../scripts/sadt")"
+fi
+
+samples="${0%/*}/sadt"
+
+run_sadt() {
+ dir="$1"
+ shift
+ (cd "$samples/$dir" && $sadt "$@")
+}
+
+test_passes() {
+ assertPasses run_sadt passes
+}
+
+test_superficial() {
+ assertPasses run_sadt superficial
+ assertFails run_sadt superficial-fails
+}
+
+test_flaky() {
+ assertPasses run_sadt flaky
+}
+
+test_skippable() {
+ assertPasses run_sadt skippable
+}
+
+test_skippable_fails() {
+ assertFails run_sadt unskippable
+ assertFails run_sadt unskipped
+}
+
+test_fails() {
+ assertFails run_sadt fails
+}
+
+test_space_separated_tests() {
+ assertPasses run_sadt space-separated-tests
+ assertFalse "skipped=1 found in output" "grep -q skipped=1 $log"
+}
+
+test_comma_separated_tests() {
+ assertPasses run_sadt comma-separated-tests
+ assertFalse "skipped=1 found in output" "grep -q skipped=1 $log"
+}
+
+test_space_separated_restrictions() {
+ assertPasses run_sadt space-separated-restrictions
+ assertFalse "skipped=1 found in output" "grep -q skipped=1 $log"
+}
+
+test_comma_separated_restrictions() {
+ assertPasses run_sadt comma-separated-restrictions
+ assertFalse "skipped=1 found in output" "grep -q skipped=1 $log"
+}
+
+test_tests_directory() {
+ assertPasses run_sadt tests-directory
+ assertFalse "skipped=1 found in output" "grep -q skipped=1 $log"
+}
+
+test_test_command() {
+ assertPasses run_sadt test-command --verbose
+ assertTrue "recognizes Test-Command" "grep 'O: Test-Command is supported' $log"
+ assertTrue "recognizes Test-Command" "grep tests=1 $log"
+}
+
+test_run_specific_tests() {
+ assertPasses run_sadt comma-separated-tests --verbose test1
+ assertTrue "runs test1" "grep '^test1:' $log"
+ assertFalse "does not run test2" "grep '^test2:' $log"
+}
+
+. shunit2