fstests: move test group info to test files
[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 . ./common/preamble
10 _begin_fstest auto quick
11
12 _register_cleanup "_cleanup" BUS
13
14 # Import common functions.
15
16 # real QA test starts here
17 _supported_fs xfs
18 _require_scratch
19
20 cat > $tmp.a << ENDL
21 echo This is file A
22 source $tmp.b
23 ENDL
24 cat > $tmp.b << ENDL
25 echo This is file B
26 ENDL
27
28 echo "Test with -c"
29 _scratch_mkfs > $seqres.full 2>&1
30 _scratch_xfs_db -c "sb 0" -c "p magicnum" -c "source $tmp.a" -c "p magicnum" | sed -e 's/0x58465342/XFS_MAGIC/g'
31
32 echo "Test with interactive"
33 (echo "sb 0"; sleep 0.5;
34  echo "p magicnum"; sleep 0.5;
35  echo "source $tmp.a"; sleep 0.5;
36  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 =)'
37
38 # success, all done
39 status=0
40 exit