File: tc02.sh

package info (click to toggle)
python-os-refresh-config 14.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 192 kB
  • sloc: python: 285; sh: 191; makefile: 18
file content (46 lines) | stat: -rwxr-xr-x 875 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#
# Runs dib-run-parts on directory containing some scripts.
#

set -ue
set -o pipefail
set -x

TESTS_BASE_DIR=$(cd $(dirname "$0") && pwd)

DRP_BIN=${TESTS_BASE_DIR}/../dib-run-parts

TEST_EXEC_DIR=${TESTS_BASE_DIR}/tc02/td

rval=0

RES=$(${DRP_BIN} --list ${TEST_EXEC_DIR})
if test $? -ne 0; then
    echo "*** FAILED: --list failed"
    rval=1
fi

EXPECTED="${TESTS_BASE_DIR}/tc02/td/call_me_1
${TESTS_BASE_DIR}/tc02/td/call_me_2"

if test "${EXPECTED}" != "${RES}"; then
    echo "*** FAILED: --list returns incorrect result"
    rval=1
fi

RES=$(${DRP_BIN} ${TEST_EXEC_DIR} 2>/dev/null)
if test $? -ne 0; then
    echo "*** FAILED: dib-run-parts on empty dir failed"
    rval=1
fi

EXPECTED="call_me_1 called
call_me_2 called"

if test "${EXPECTED}" != "${RES}"; then
    echo "*** FAILED: dib-run-parts returns incorrect result"
    rval=1
fi

exit ${rval}