Fixed PATHs for test files #54
Conversation
Shouldn't track error.log
There was a problem hiding this comment.
Code Review
This pull request adapts the test suite for Termux and Android environments by normalizing system paths, configuring environment-specific temporary directories, and refactoring the test runner for improved reporting. Review feedback suggests maintaining portability by avoiding hardcoded Termux-specific paths in shebangs and script calls, restoring robust error handling flags in the test runner, and removing an accidentally committed log file.
| @@ -1,4 +1,4 @@ | |||
| #!/usr/bin/env bats | |||
| #!/data/data/com.termux/files/usr/bin/bats | |||
There was a problem hiding this comment.
Hardcoding the absolute path to the Termux bats binary in the shebang breaks portability for non-Termux environments. Since the run.sh runner already identifies the correct BATS_BIN and invokes it explicitly, the shebang is not strictly necessary for the runner to work. It is better to use #!/usr/bin/env bats to maintain compatibility across different systems.
#!/usr/bin/env bats
| --filter) FILTER="${2:-}"; shift 2;; # next argument is the filter string | ||
| *) SINGLE_FILE="$1"; shift;; # treat any other arg as a file path | ||
| esac | ||
| set -uo pipefail |
There was a problem hiding this comment.
The removal of -e (exit on error) and -E (errtrap inheritance) makes the script less robust. While you are capturing exit codes for individual tests, other critical commands like cd "$ROOT_DIR" (line 120) could fail silently. It is recommended to keep these flags and handle test failures explicitly (e.g., by appending || true to the run_one call if you want the loop to continue).
| set -uo pipefail | |
| set -Eeuo pipefail |
| echo "[STEP 1] Starting infrastructure..." | ||
|
|
||
| bash Backend/cybercafe.sh run > "$LOG_DIR/run.log" 2>&1 & | ||
| /data/data/com.termux/files/usr/bin/bash "$CYBERCAFE_SH" run > "$LOG_DIR/run.log" 2>&1 & |
There was a problem hiding this comment.
Hardcoding the absolute path to the Termux bash binary reduces the portability of the test script. Since the run.sh runner already configures the PATH to include Termux-specific directories (lines 12-21 in run.sh), you can simply use bash here. This ensures the script remains compatible with standard Linux and macOS environments while still working correctly on Termux when invoked via the runner. This applies to lines 50, 64, and 80 as well.
| /data/data/com.termux/files/usr/bin/bash "$CYBERCAFE_SH" run > "$LOG_DIR/run.log" 2>&1 & | |
| bash "$CYBERCAFE_SH" run > "$LOG_DIR/run.log" 2>&1 & |
| Tue Apr 21 22:49:55 EDT 2026 Error in Cybercafe_internetSessionFunctions.sh: Line 24 | ||
|
|
||
| iptables v1.6.1: Couldn't find target `iptmon_tx' | ||
|
|
||
| Try `iptables -h' or 'iptables --help' for more information. | ||
| iptables v1.6.1: Couldn't find target `iptmon_rx' | ||
|
|
||
| Try `iptables -h' or 'iptables --help' for more information. | ||
| iptables: No chain/target/match by that name. | ||
| iptables: No chain/target/match by that name. | ||
| iptables: No chain/target/match by that name. | ||
| iptables: Bad rule (does a matching rule exist in that chain?). | ||
| iptables: Bad rule (does a matching rule exist in that chain?). | ||
| RTNETLINK answers: No such file or directory |
Fixed PATHs for test files so they work in Termux su shell