From efe47381c599b07e4c7bbdb2e91e8090a541c887 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:53:52 +0200 Subject: Adding upstream version 2.23.4+deb12u1. Signed-off-by: Daniel Baumann --- test/test_sadt | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 test/test_sadt (limited to 'test/test_sadt') 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 +# +# 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 . + +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 -- cgit v1.2.3