Skip to content

Commit

Permalink
add /dev/full checking to exec test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sekiguchi-nagisa committed Dec 7, 2023
1 parent f118bc6 commit 44ffd1a
Show file tree
Hide file tree
Showing 18 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_command.ds
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ command -V hferure fhaueirnv
assert($? != 0)

# io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
## external
assert "$(command -V ls 2>&1 > /dev/full)" =~ $/command: io error:.+/
assert $? == 1
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_complete5.ds
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ assert $? == 1
assert "$(complete -m 'TMD(34)' 2>&1)" == "${$SCRIPT_NAME.basename()}:200: complete: TMD(34): unrecognized module descriptor"
assert "$(complete -m 'TMD(hoge)' 2>&1)" == "${$SCRIPT_NAME.basename()}:201: complete: TMD(hoge): unrecognized module descriptor"

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(complete '$(' 2>&1 > /dev/full)" =~ $/: complete: io error:.+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_dirs1.ds
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ assert pushd -q 2>&1 | grep -E 'pushd: pushd \[\+N | -N | dir]'
assert $PIPESTATUS[0] == 2

# io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(pushd / 2>&1 > /dev/full )" =~ $/pushd: io error:.+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_dirs2.ds
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ assert popd -r 2>&1 | grep -E '^popd: popd \[\+N | -N]'
assert $PIPESTATUS[0] == 2

# io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(pushd / && popd 2>&1 > /dev/full )" =~ $/popd: io error:.+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_dirs3.ds
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ assert dirs -u 2>&1 | grep -E '^dirs: dirs \[-clpv]'
assert $PIPESTATUS[0] == 2

# io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(dirs 2>&1 > /dev/full )" =~ $/dirs: io error:.+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_echo1.ds
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#$test($out = $'hello world\n', $err = $'hogehoge\n')

## io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(echo hekllo world 2>&1 > /dev/full)" =~ $/: echo: io error: .+/
}

Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_hash.ds
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ assert("$(hash)" == "hash: file path cache is empty")
assert(hash -r)

## error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
var a = "$(hash 2>&1 > /dev/full)"
assert $a =~ $/hash: io error: .+/ : $a
assert $? == 1
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_kill.ds
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for(var i = 0; $i < $expect.size(); $i++) {
assert $e_str == $actual[$i] : "\`$e_str', \`${$actual[$i]}'"
}

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(kill -l 2>&1 > /dev/full)" =~ $/kill: io error: .+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_printf1.ds
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ assert "$(printf $'%\x00' 34 2>&1)" ==
"${$SCRIPT_NAME.basename()}:43: printf: \`\x00': invalid conversion specifier"

## io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(printf '%9999s' hello 2>&1 > /dev/full)" =~ $/: printf: format failed, .+/
assert "$(printf '%9999d' 12 2>&1 > /dev/full)" =~ $/: printf: format failed, .+/
}
Expand Down
4 changes: 2 additions & 2 deletions test/exec/cases/base/builtin_printf4.ds
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ function assertFormat(c : String) {
}

let conversions = 'aAbBcCdDeFgGhHIjmMnprRsStTuUVwWxXyYzZ%'
for converion in $conversions {
$assertFormat($converion)
for conversion in $conversions {
$assertFormat($conversion)
}

## 'k', 'l' specifiers are not implemented musl
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_puts_gets.ds
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ assert $PIPESTATUS[0] == 2 && $PIPESTATUS[1] == 0
assert __puts -3 hoge 2>&1 > /dev/null | grep ': __puts: -3: invalid option'
assert $PIPESTATUS[0] == 2 && $PIPESTATUS[1] == 0

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(__puts -1 2>&1 hello > /dev/full)" =~ $/: __puts: io error:/
assert $? == 1

Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_pwd.ds
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ assert pwd 2>&1 | grep ': pwd: \.: No such file or directory'
assert $PIPESTATUS[0] == 1

# io error
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(cd && pwd 2>&1 > /dev/full )" =~ $/pwd: io error:.+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_setenv.ds
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ assert $PIPESTATUS[0] == 2

assert setenv > /dev/null
assert "$(setenv | grep -v '^_=')" == "$(env | grep -v '^_=')"
if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(setenv 2>&1 > /dev/full)" =~ $/: setenv: io error:.+/
assert $? == 1
}
Expand Down
6 changes: 3 additions & 3 deletions test/exec/cases/base/builtin_shctl1.ds
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ assert "$(shctl function)" == "<toplevel>"
shctl function
assert $? == 1

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(shctl function 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
}
Expand All @@ -53,7 +53,7 @@ shctl is-interactive
assert $? == 1
assert shctl backtrace

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(shctl backtrace 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
}
Expand Down Expand Up @@ -85,7 +85,7 @@ assert $reply["DATA_HOME"] == $DATA_HOME
assert $reply["MODULE_DIR"] == $MODULE_DIR
assert $reply["DATA_DIR"] == $DATA_DIR

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(shctl info 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_shctl2.ds
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ assert shctl set | grep 'monitor * off'
assert shctl set | grep 'clobber * on'
shctl set | grep 'assert.* on' || _exit

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(shctl set 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
}
Expand Down
4 changes: 2 additions & 2 deletions test/exec/cases/base/builtin_shctl3.ds
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ assert $a[2] == "${$SCRIPT_NAME.realpath()}"
assert $a[3] == "${"$SCRIPT_DIR/../../_module4test/module4.ds".realpath()}"
assert $a[4] == "${"$SCRIPT_DIR/../../_module4test/module3.ds".realpath()}"

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(shctl module 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
}
Expand All @@ -27,7 +27,7 @@ assert $? == 1
assert $a.size() == 1
assert $a[0] == "$SCRIPT_DIR/../../_module4test/module4.ds".realpath()

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(cd $SCRIPT_DIR &&
shctl module ../../_module4test/module4.ds hogehoge 2>&1 > /dev/full)" =~ $/shctl: io error: .+/
assert $? == 1
Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_ulimit.ds
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ assert "$(ulimit -a)" == "$(ulimit $opts)"
assert "$(ulimit -a -H)" == "$(ulimit $opts -H)"
assert "$(ulimit -a -S)" == "$(ulimit $opts -S)"

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(ulimit -a 2>&1 > /dev/full)" =~ $/ulimit: io error: .+/
assert $? == 1

Expand Down
2 changes: 1 addition & 1 deletion test/exec/cases/base/builtin_umask.ds
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ assert $? == 2
$assertEQ("${$SCRIPT_NAME.basename()}:11: umask: -y: invalid option
umask: umask [-p] [-S] [mode]", "$(umask -y 2>&1)")

if $OSTYPE == 'linux' {
if (test -e /dev/full) {
assert "$(umask 2>&1 > /dev/full)" =~ $/umask: io error: .+/
assert $? == 1
}
Expand Down

0 comments on commit 44ffd1a

Please sign in to comment.