Bug in shell test suite for `type` command

I finished Redirection section a few months back. I’m now trying to work on the next couple of sections, but without any code change the test runner is failing me:

[tester::#MG5\] Running tests for Stage #MG5 (Locate executable files)
[tester::#MG5\] \[setup\] export PATH=/tmp/cow:$PATH
[tester::#MG5\] \[setup\] export PATH=/tmp/bee:$PATH
[tester::#MG5\] \[setup\] export PATH=/tmp/pig:$PATH
[tester::#MG5\] \[setup\] PATH is now: /tmp/pig:/tmp/bee:/tmp/cow:/go/bin:…
[tester::#MG5\] \[setup\] Available executables:
[tester::#MG5\] \[setup\] - my_exe
[tester::#MG5\] Running ./your_program.sh
[your-program\] $ type cat
[your-program\] cat is /bin/cat
[tester::#MG5\] ✓ Received expected response
[your-program\] $ type cp
[your-program\] cp is /bin/cp
[tester::#MG5\] ✓ Received expected response
[your-program\] $ type mkdir
[your-program\] mkdir is /bin/mkdir
[tester::#MG5\] ✓ Received expected response
[your-program\] $ type my_exe
[your-program\] my_exe is /tmp/pig/my_exe
[tester::#MG5\] ^ Line does not match expected value.
[tester::#MG5\] Expected: “my_exe is /tmp/bee/my_exe”
[tester::#MG5\] Received: “my_exe is /tmp/pig/my_exe”
[your-program\] $
[tester::#MG5\] Assertion failed.
[tester::#MG5\] Test failed

I printed the content of the 3 tmp dirs (cow, bee, pig) and can confirm that my_exe exists in all three dirs. Because the expected response is /tmp/bee/ (second dir) , my_exe should not be in the first dir but somehow it ends up there and is causing this error.

While I cannot rule out a bug, they did “improve” the test a while back. Based on the test setup, the executable one that in your example run is in the first folder should not be an executable. Are you verifying that you are only matching executable files?

1 Like

Thanks for that. Indeed there was a my_exe in the first dir that was not an executable. After handling that I passed the test.

Could you please point me to where to look for the test setup? Is it in their repo? In this case printf debugging wouldn’t help me to find the issue because I was missing the “check executable” logic and wouldn’t be able to figure this out without examining the test environment itself.