common: kill _supported_os
[xfstests-dev.git] / tests / xfs / 138
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 138
6 #
7 # Test nesting the 'source' command in xfs_db via -c and interactive.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
17
18 _cleanup()
19 {
20         cd /
21         rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26
27 # real QA test starts here
28 _supported_fs xfs
29 _require_scratch
30
31 cat > $tmp.a << ENDL
32 echo This is file A
33 source $tmp.b
34 ENDL
35 cat > $tmp.b << ENDL
36 echo This is file B
37 ENDL
38
39 echo "Test with -c"
40 _scratch_mkfs > $seqres.full 2>&1
41 _scratch_xfs_db -c "sb 0" -c "p magicnum" -c "source $tmp.a" -c "p magicnum" | sed -e 's/0x58465342/XFS_MAGIC/g'
42
43 echo "Test with interactive"
44 (echo "sb 0"; sleep 0.5;
45  echo "p magicnum"; sleep 0.5;
46  echo "source $tmp.a"; sleep 0.5;
47  echo "p magicnum"; sleep 0.5) | _scratch_xfs_db 2>&1 | sed -e 's/xfs_db> //g' -e 's/0x58465342/XFS_MAGIC/g' | egrep '(This is file|magicnum =)'
48
49 # success, all done
50 status=0
51 exit