191 lines · python
1# Check the not command2 3# RUN: not %{lit} -a %{inputs}/shtest-not \4# RUN: | FileCheck -match-full-lines %s5#6# END.7 8# Make sure not and env commands are included in printed commands.9 10# CHECK: -- Testing: 17 tests{{.*}}11 12# CHECK: FAIL: shtest-not :: exclamation-args-nested-none.txt {{.*}}13# CHECK: ! ! !14# CHECK: # executed command: ! ! !15# CHECK: # | Error: '!' requires a subcommand16# CHECK: # error: command failed with exit status: {{.*}}17 18# CHECK: FAIL: shtest-not :: exclamation-args-none.txt {{.*}}19# CHECK: !20# CHECK: # executed command: !21# CHECK: # | Error: '!' requires a subcommand22# CHECK: # error: command failed with exit status: {{.*}}23 24# CHECK: FAIL: shtest-not :: exclamation-calls-external.txt {{.*}}25 26# CHECK: ! [[PYTHON:.*]] fail.py27# CHECK: # executed command: ! [[PYTHON_BARE:.*]] fail.py28# CHECK: ! ! [[PYTHON]] pass.py29# CHECK: # executed command: ! ! [[PYTHON_BARE]] pass.py30# CHECK: ! ! ! [[PYTHON]] fail.py31# CHECK: # executed command: ! ! ! [[PYTHON_BARE]] fail.py32# CHECK: ! ! ! ! [[PYTHON]] pass.py33# CHECK: # executed command: ! ! ! ! [[PYTHON_BARE]] pass.py34 35# CHECK: ! [[PYTHON]] pass.py36# CHECK: # executed command: ! [[PYTHON_BARE]] pass.py37# CHECK: # error: command failed with exit status: {{.*}}38 39# CHECK: FAIL: shtest-not :: not-args-last-is-crash.txt {{.*}}40# CHECK: not --crash41# CHECK: # executed command: not --crash42# CHECK: # | Error: 'not' requires a subcommand43# CHECK: # error: command failed with exit status: {{.*}}44 45# CHECK: FAIL: shtest-not :: not-args-nested-none.txt {{.*}}46# CHECK: not not not47# CHECK: # executed command: not not not48# CHECK: # | Error: 'not' requires a subcommand49# CHECK: # error: command failed with exit status: {{.*}}50 51# CHECK: FAIL: shtest-not :: not-args-none.txt {{.*}}52# CHECK: not53# CHECK: # executed command: not54# CHECK: # | Error: 'not' requires a subcommand55# CHECK: # error: command failed with exit status: {{.*}}56 57# CHECK: FAIL: shtest-not :: not-calls-cd.txt {{.*}}58# CHECK: not not cd foobar59# CHECK: # executed command: not not cd foobar60# CHECK: not --crash cd foobar61# CHECK: # executed command: not --crash cd foobar62# CHECK: # | Error: 'not --crash' cannot call 'cd'63# CHECK: # error: command failed with exit status: {{.*}}64 65# CHECK: FAIL: shtest-not :: not-calls-colon.txt {{.*}}66# CHECK: not not : foobar67# CHECK: # executed command: not not : foobar68# CHECK: not --crash :69# CHECK: # executed command: not --crash :70# CHECK: # | Error: 'not --crash' cannot call ':'71# CHECK: # error: command failed with exit status: {{.*}}72 73# CHECK: FAIL: shtest-not :: not-calls-diff-with-crash.txt {{.*}}74# CHECK: not --crash diff -u {{.*}}75# CHECK: # executed command: not --crash diff -u {{.*}}76# CHECK-NOT: # executed command: {{.*}}77# CHECK-NOT: {{[Ee]rror}}78# CHECK: # error: command failed with exit status: {{.*}}79# CHECK-NOT: # executed command: {{.*}}80# CHECK-NOT: {{[Ee]rror}}81 82# CHECK: FAIL: shtest-not :: not-calls-diff.txt {{.*}}83# CHECK: not diff {{.*}}84# CHECK: # executed command: not diff {{.*}}85# CHECK: not not not diff {{.*}}86# CHECK: # executed command: not not not diff {{.*}}87# CHECK: not not not not not diff {{.*}}88# CHECK: # executed command: not not not not not diff {{.*}}89# CHECK: diff {{.*}}90# CHECK: # executed command: diff {{.*}}91# CHECK: not not diff {{.*}}92# CHECK: # executed command: not not diff {{.*}}93# CHECK: not not not not diff {{.*}}94# CHECK: # executed command: not not not not diff {{.*}}95# CHECK: not diff {{.*}}96# CHECK: # executed command: not diff {{.*}}97# CHECK-NOT: # executed command: {{.*}}98 99# CHECK: FAIL: shtest-not :: not-calls-echo.txt {{.*}}100# CHECK: not not echo hello world101# CHECK: # executed command: not not echo hello world102# CHECK: not --crash echo hello world103# CHECK: # executed command: not --crash echo hello world104# CHECK: # | Error: 'not --crash' cannot call 'echo'105# CHECK: # error: command failed with exit status: {{.*}}106 107# CHECK: FAIL: shtest-not :: not-calls-env-builtin.txt {{.*}}108# CHECK: not --crash env -u FOO BAR=3 rm {{.*}}.no-such-file109# CHECK: # executed command: not --crash env -u FOO BAR=3 rm {{.+}}.no-such-file{{.*}}110# CHECK: # | Error: 'env' cannot call 'rm'111# CHECK: # error: command failed with exit status: {{.*}}112 113# CHECK: FAIL: shtest-not :: not-calls-export.txt {{.*}}114# CHECK: not not export FOO=1115# CHECK: # executed command: not not export FOO=1116# CHECK: not --crash export BAZ=3117# CHECK: # executed command: not --crash export BAZ=3118# CHECK: # | Error: 'not --crash' cannot call 'export'119# CHECK: # error: command failed with exit status: {{.*}}120 121 122# CHECK: PASS: shtest-not :: not-calls-external.txt {{.*}}123 124# CHECK: not [[PYTHON]] fail.py125# CHECK: # executed command: not [[PYTHON_BARE]] fail.py126# CHECK: not not [[PYTHON]] pass.py127# CHECK: # executed command: not not [[PYTHON_BARE]] pass.py128# CHECK: not not not [[PYTHON]] fail.py129# CHECK: # executed command: not not not [[PYTHON_BARE]] fail.py130# CHECK: not not not not [[PYTHON]] pass.py131# CHECK: # executed command: not not not not [[PYTHON_BARE]] pass.py132 133# CHECK: not not --crash [[PYTHON]] pass.py134# CHECK: # executed command: not not --crash [[PYTHON_BARE]] pass.py135# CHECK: not not --crash [[PYTHON]] fail.py136# CHECK: # executed command: not not --crash [[PYTHON_BARE]] fail.py137# CHECK: not not --crash not [[PYTHON]] pass.py138# CHECK: # executed command: not not --crash not [[PYTHON_BARE]] pass.py139# CHECK: not not --crash not [[PYTHON]] fail.py140# CHECK: # executed command: not not --crash not [[PYTHON_BARE]] fail.py141 142# CHECK: env not [[PYTHON]] fail.py | {{.*}}143# CHECK: # executed command: env not [[PYTHON_BARE]] fail.py144# CHECK: not env [[PYTHON]] fail.py | {{.*}}145# CHECK: # executed command: not env [[PYTHON_BARE]] fail.py146# CHECK: env FOO=1 not [[PYTHON]] fail.py | {{.*}}147# CHECK: # executed command: env FOO=1 not [[PYTHON_BARE]] fail.py148# CHECK: not env FOO=1 BAR=1 [[PYTHON]] fail.py | {{.*}}149# CHECK: # executed command: not env FOO=1 BAR=1 [[PYTHON_BARE]] fail.py150# CHECK: env FOO=1 BAR=1 not env -u FOO BAR=2 [[PYTHON]] fail.py | {{.*}}151# CHECK: # executed command: env FOO=1 BAR=1 not env -u FOO BAR=2 [[PYTHON_BARE]] fail.py152# CHECK: not env FOO=1 BAR=1 not env -u FOO -u BAR [[PYTHON]] pass.py | {{.*}}153# CHECK: # executed command: not env FOO=1 BAR=1 not env -u FOO -u BAR [[PYTHON_BARE]] pass.py154# CHECK: not not env FOO=1 env FOO=2 BAR=1 [[PYTHON]] pass.py | {{.*}}155# CHECK: # executed command: not not env FOO=1 env FOO=2 BAR=1 [[PYTHON_BARE]] pass.py156# CHECK: env FOO=1 -u BAR env -u FOO BAR=1 not not [[PYTHON]] pass.py | {{.*}}157# CHECK: # executed command: env FOO=1 -u BAR env -u FOO BAR=1 not not [[PYTHON_BARE]] pass.py158 159# CHECK: not env FOO=1 BAR=1 env FOO=2 BAR=2 not --crash [[PYTHON]] pass.py | {{.*}}160# CHECK: # executed command: not env FOO=1 BAR=1 env FOO=2 BAR=2 not --crash [[PYTHON_BARE]] pass.py161# CHECK: not env FOO=1 BAR=1 not --crash not [[PYTHON]] pass.py | {{.*}}162# CHECK: # executed command: not env FOO=1 BAR=1 not --crash not [[PYTHON_BARE]] pass.py163# CHECK: not not --crash env -u BAR not env -u FOO BAR=1 [[PYTHON]] pass.py | {{.*}}164# CHECK: # executed command: not not --crash env -u BAR not env -u FOO BAR=1 [[PYTHON_BARE]] pass.py165 166 167# CHECK: FAIL: shtest-not :: not-calls-fail2.txt {{.*}}168# CHECK-NEXT: {{.*}} TEST 'shtest-not :: not-calls-fail2.txt' FAILED {{.*}}169# CHECK-NEXT: Exit Code: 1170 171# CHECK: FAIL: shtest-not :: not-calls-mkdir.txt {{.*}}172# CHECK: not mkdir {{.*}}173# CHECK: # executed command: not mkdir {{.*}}174# CHECK: not --crash mkdir foobar175# CHECK: # executed command: not --crash mkdir foobar176# CHECK: # | Error: 'not --crash' cannot call 'mkdir'177# CHECK: # error: command failed with exit status: {{.*}}178 179# CHECK: FAIL: shtest-not :: not-calls-rm.txt {{.*}}180# CHECK: not rm {{.*}}181# CHECK: # executed command: not rm {{.*}}182# CHECK: not --crash rm foobar183# CHECK: # executed command: not --crash rm foobar184# CHECK: # | Error: 'not --crash' cannot call 'rm'185# CHECK: # error: command failed with exit status: {{.*}}186 187# CHECK: Total Discovered Tests: 17188# CHECK: Passed: 1 {{\([0-9]*\.[0-9]*%\)}}189# CHECK: Failed: 16 {{\([0-9]*\.[0-9]*%\)}}190# CHECK-NOT: {{.}}191