Skip to content

Fixed PATHs for test files #54

Merged
Daniel-Lopez246 merged 2 commits into
mainfrom
Feature/Utility-Library-(ASU-CIDSE-2025-Fall)
Apr 22, 2026
Merged

Fixed PATHs for test files #54
Daniel-Lopez246 merged 2 commits into
mainfrom
Feature/Utility-Library-(ASU-CIDSE-2025-Fall)

Conversation

@Daniel-Lopez246

Copy link
Copy Markdown
Collaborator

Fixed PATHs for test files so they work in Termux su shell

@Daniel-Lopez246 Daniel-Lopez246 merged commit 6b5ba1c into main Apr 22, 2026
1 check failed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

Comment thread Backend/test/run.sh
--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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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).

Suggested change
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 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
/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 &

Comment thread Backend/test/error.log
Comment on lines +1 to +14
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file appears to be a log generated during a test run and should not be committed to the repository. Please remove it.

@Daniel-Lopez246 Daniel-Lopez246 deleted the Feature/Utility-Library-(ASU-CIDSE-2025-Fall) branch April 24, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant