-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixed.bash
More file actions
executable file
·60 lines (46 loc) · 1.15 KB
/
Copy pathtest_fixed.bash
File metadata and controls
executable file
·60 lines (46 loc) · 1.15 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash -xv
# SPDX-FileCopyrightText: 2025 Ryuichi Ueda ryuichiueda@gmail.com
# SPDX-License-Identifier: GPL-3.0-or-later
err () {
echo $0 >> ./error
echo "ERROR!" FILE: $0, LINENO: $1
rm -f $tmp-*
exit 1
}
repo_dir=${2:-~/GIT/rusty_bash}
test_dir="$PWD"
com="$repo_dir/target/debug/sush"
cd "$repo_dir"
tmp=/tmp/$$
[ "$1" == "nobuild" ] || cargo build || err $LINENO
cd "$test_dir"
res=$($com /bin/sh)
[ $? -eq 126 ] || err $LINENO
res=$($com << 'EOF'
trap 'echo USR1' USR1
kill -s USR1 $$
sleep 0.5
sleep 0.5
EOF
)
[ "$res" = "USR1" ] || err $LINENO
cat << 'EOF' | $com
trap 'true' EXIT
false
EOF
[ $? -eq 1 ] || err $LINENO
res=$($com <<< 'PATH=/ ; command -pv bash')
[ $? -eq 0 ] || err $LINENO
res=$($com <<< 'A=久里浜YRP野比長沢; echo ${A:3:-1}')
[ "$res" = "YRP野比長" ] || err $LINENO
res=$($com <<< 'A=久里浜YRP野比長沢; echo ${A:3:-2}')
[ "$res" = "YRP野比" ] || err $LINENO
res=$($com <<< "echo {$'\x0'..a}")
[ $? -eq 0 ] || err $LINENO
res=$($com <<< 'printf \\0\\7 | xxd -ps')
[ "$res" = "0007" ] || err $LINENO
res=$($com <<< 'printf \\777 | xxd -ps')
[ "$res" = "ff" ] || err $LINENO
rm -f $tmp-*
echo $0 >> ./ok
exit