Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a1c0bd3
initial test: add TUI progress monitor
Jun 29, 2026
0b6ef87
build: update embedded ring loadables
jkool702 Jun 29, 2026
8a70aae
Merge pull request #408 from jkool702/auto-build/update-loadables-284…
jkool702 Jun 29, 2026
0c8e5fc
new TUI
Jun 30, 2026
9f80b77
build: update embedded ring loadables
jkool702 Jun 30, 2026
864d6b9
Merge pull request #409 from jkool702/auto-build/update-loadables-284…
jkool702 Jun 30, 2026
908f3f6
new TUI
Jun 30, 2026
29d3b88
build: update embedded ring loadables
jkool702 Jun 30, 2026
028420d
Merge pull request #410 from jkool702/auto-build/update-loadables-284…
jkool702 Jun 30, 2026
4a28335
new TUI
Jun 30, 2026
b1d8a16
build: update embedded ring loadables
jkool702 Jun 30, 2026
0f79471
Merge pull request #411 from jkool702/auto-build/update-loadables-284…
jkool702 Jul 1, 2026
8ebdee4
new TUI
Jul 1, 2026
a3700ad
build: update embedded ring loadables
jkool702 Jul 1, 2026
d276858
Merge pull request #412 from jkool702/auto-build/update-loadables-284…
jkool702 Jul 1, 2026
a5df321
new TUI
Jul 1, 2026
9dd007c
build: update embedded ring loadables
jkool702 Jul 1, 2026
957d5d7
Merge pull request #413 from jkool702/auto-build/update-loadables-285…
jkool702 Jul 1, 2026
0ce6516
new TUI
Jul 1, 2026
4dc4f15
build: update embedded ring loadables
jkool702 Jul 1, 2026
f25262f
Merge pull request #415 from jkool702/auto-build/update-loadables-285…
jkool702 Jul 1, 2026
f579a99
new TUI
Jul 1, 2026
2cf3771
build: update embedded ring loadables
jkool702 Jul 1, 2026
38b2cf1
Merge pull request #416 from jkool702/auto-build/update-loadables-285…
jkool702 Jul 1, 2026
0056948
new TUI - fix for bytes mode
Jul 1, 2026
97cd297
build: update embedded ring loadables
jkool702 Jul 1, 2026
1aec1c3
Merge pull request #417 from jkool702/auto-build/update-loadables-285…
jkool702 Jul 2, 2026
0a5e814
colorized TUI
Jul 2, 2026
56d188b
build: update embedded ring loadables
jkool702 Jul 2, 2026
e64e09a
Merge pull request #418 from jkool702/auto-build/update-loadables-285…
jkool702 Jul 2, 2026
c6f5c5b
minor TUI tweaks
Jul 2, 2026
11de237
build: update embedded ring loadables
jkool702 Jul 2, 2026
f77e750
Merge pull request #419 from jkool702/auto-build/update-loadables-286…
jkool702 Jul 2, 2026
82c86a7
added gif+webm of TUI
Jul 2, 2026
a2cf1a5
add frun cmdline to TUI
Jul 3, 2026
4ce2d33
build: update embedded ring loadables
jkool702 Jul 3, 2026
4e589d7
Merge pull request #420 from jkool702/auto-build/update-loadables-286…
jkool702 Jul 3, 2026
6f7c5d8
minor TUI tweaks
Jul 3, 2026
c0d65d0
build: update embedded ring loadables
jkool702 Jul 3, 2026
f3cd13b
Merge pull request #421 from jkool702/auto-build/update-loadables-286…
jkool702 Jul 3, 2026
dcff658
New TUI gif/webm
Jul 3, 2026
2356b6b
sync nob64 versions
Jul 3, 2026
dcbd832
Merge pull request #414 from jkool702/NEW/TUI2
jkool702 Jul 3, 2026
d6f2ed6
update TUI demo webm
Jul 3, 2026
c2ee087
minor TUI tweaks
Jul 3, 2026
2bf8b0e
build: update embedded ring loadables
jkool702 Jul 3, 2026
09cfe50
Merge pull request #424 from jkool702/auto-build/update-loadables-286…
jkool702 Jul 4, 2026
9c1156f
update TUI demo vids
Jul 4, 2026
9e87c79
added SLURM preemption to frun.bash
Jul 4, 2026
09cfc17
sync forkrun_ring.c.txt
Jul 5, 2026
a2e9d5a
remove wc -c TUI dependency
Jul 6, 2026
703b2ca
bump to v3.4.0
Jul 6, 2026
f4cfe94
build: update embedded ring loadables
jkool702 Jul 6, 2026
f7e07ca
Merge pull request #425 from jkool702/auto-build/update-loadables-287…
jkool702 Jul 6, 2026
35b91cf
bump version to v3.4.0
Jul 6, 2026
392e2de
make forkrun regognize cgroup limits for cpu allocation
Jul 6, 2026
cda1519
build: update embedded ring loadables
jkool702 Jul 6, 2026
6363a44
Merge pull request #426 from jkool702/auto-build/update-loadables-288…
jkool702 Jul 6, 2026
2938564
add halt functionality
Jul 6, 2026
def8e9c
build: update embedded ring loadables
jkool702 Jul 6, 2026
e5a2ad3
Merge pull request #427 from jkool702/auto-build/update-loadables-288…
jkool702 Jul 6, 2026
5a75b60
sync fron.nob64
Jul 6, 2026
3eaf9d1
added multi-parameter input sweep
Jul 7, 2026
de9e294
sync nob64 versions
Jul 7, 2026
b401a85
build: update embedded ring loadables
jkool702 Jul 7, 2026
669cda7
Merge pull request #428 from jkool702/auto-build/update-loadables-288…
jkool702 Jul 7, 2026
2f54a88
improved multi-parameter sweep
Jul 7, 2026
6cab223
improved multi-parameter sweep
Jul 7, 2026
5a967eb
improved multi-parameter sweep
Jul 7, 2026
8d8411e
improved multi-parameter sweep
Jul 7, 2026
1712413
improved multi-parameter sweep
Jul 7, 2026
2ec44e0
new unit tests
Jul 7, 2026
e82422d
fix multi-parameter sweep parsing issue
Jul 7, 2026
b6927a4
minor fixes for halt functionality
Jul 7, 2026
c0503d6
build: update embedded ring loadables
jkool702 Jul 7, 2026
ae76ded
Merge pull request #429 from jkool702/auto-build/update-loadables-288…
jkool702 Jul 7, 2026
11cb38f
fix for --halt
Jul 7, 2026
e3736ee
build: update embedded ring loadables
jkool702 Jul 7, 2026
221d49c
Merge pull request #430 from jkool702/auto-build/update-loadables-288…
jkool702 Jul 7, 2026
b02fe88
add signal relay for USR1 and TERM traps for SLURM preemption
Jul 7, 2026
1c1759c
new fix
Jul 7, 2026
66e4e61
build: update embedded ring loadables
jkool702 Jul 7, 2026
33f4092
Merge pull request #431 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
7d8651c
new v3.4.0 unit tests
Jul 8, 2026
1a3cc2b
final tweaks
Jul 8, 2026
71634f1
build: update embedded ring loadables
jkool702 Jul 8, 2026
6ed6056
Merge pull request #433 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
6f038a1
minor fix - make ring_poll_main return to bash on signals
Jul 8, 2026
f7bf756
build: update embedded ring loadables
jkool702 Jul 8, 2026
e1f486d
Merge pull request #434 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
704a0b0
minor fix for halt functionality
Jul 8, 2026
230d770
build: update embedded ring loadables
jkool702 Jul 8, 2026
38a6820
Merge pull request #435 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
487596a
minor fix
Jul 8, 2026
84c6454
build: update embedded ring loadables
jkool702 Jul 8, 2026
4f0d5eb
Merge pull request #436 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
251f6fb
fixed --halt. added new unit tests
Jul 8, 2026
abb4083
build: update embedded ring loadables
jkool702 Jul 8, 2026
9d1734d
Merge pull request #437 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
363e6bf
Merge pull request #432 from jkool702/NEW/TUI4
jkool702 Jul 8, 2026
59d2527
build: update embedded ring loadables
jkool702 Jul 8, 2026
60d5c45
Merge pull request #438 from jkool702/auto-build/update-loadables-289…
jkool702 Jul 8, 2026
ebe0d65
new UMA benchmark
Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,258 changes: 1,629 additions & 1,629 deletions BENCHMARKS/benchmark.UMA.out.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions DOCS/FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- `+v`, `--no-verbose` : Decrease verbosity. Disables --stats.
- `-V`, `--version` : Prints forkrun version number
- `--stats` : Prints NUMA statistics to stderr (currently ignored for UMA)
- `--tui`, `--progress` : Opens a live telemetry dashboard (TUI) visualizing throughput, memory footprint, and per-node CPU/queue saturation. `--no-tui`/`--no-progress` disables it.

### ERROR HANDLING & RETRIES

Expand Down
Binary file added DOCS/forkrun_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DOCS/forkrun_demo.webm
Binary file not shown.
2 changes: 1 addition & 1 deletion META
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME: forkrun
VERSION: v3.3.0
VERSION: v3.4.0
464 changes: 240 additions & 224 deletions UNIT_TESTS/RESULTS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions UNIT_TESTS/test_c_plugins.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# =============================================================================
# forkrun v3.3.0 - C Plugin Test Suite
# forkrun v3.4.0 - C Plugin Test Suite
# =============================================================================

set -o pipefail
Expand All @@ -13,7 +13,7 @@ HEADER="${UNIT_TESTS_DIR}/../ring_loadables/forkrun_plugin.h"
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"

echo "=== forkrun v3.3.0 C Plugin Test Suite ==="
echo "=== forkrun v3.4.0 C Plugin Test Suite ==="
echo "UNIT_TESTS_DIR : $UNIT_TESTS_DIR"
echo "FRUN_SCRIPT : $FRUN_SCRIPT"

Expand Down
4 changes: 2 additions & 2 deletions UNIT_TESTS/test_c_plugins_v2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# =============================================================================
# forkrun v3.3.0 - C Plugin Rigorous Test Suite
# forkrun v3.4.0 - C Plugin Rigorous Test Suite
# =============================================================================

set -o pipefail
Expand All @@ -13,7 +13,7 @@ HEADER="${UNIT_TESTS_DIR}/../ring_loadables/forkrun_plugin.h"
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"

echo "=== forkrun v3.3.0 C Plugin Rigorous Test Suite ==="
echo "=== forkrun v3.4.0 C Plugin Rigorous Test Suite ==="

# Source frun
. "$FRUN_SCRIPT"
Expand Down
2 changes: 1 addition & 1 deletion UNIT_TESTS/test_frun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ run_test_regex "Dry run (-N)" \

run_test "Version (-V)" \
"frun -V" \
"forkrun v3.3.0"
"forkrun v3.4.0"

# FIXED: Check for USAGE string explicitly without exact match
run_test_regex "Help (--help)" \
Expand Down
2 changes: 1 addition & 1 deletion UNIT_TESTS/test_frun.sh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ run_test_regex "Dry run (-N)" \

run_test "Version (-V)" \
"frun -V" \
"forkrun v3.3.0"
"forkrun v3.4.0"

# FIXED: Check for USAGE string explicitly without exact match
run_test_regex "Help (--help)" \
Expand Down
291 changes: 291 additions & 0 deletions UNIT_TESTS/test_frun_comprehensive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,297 @@
fi
fi

# ============================================================================
# SECTION R: v3.4.0 NEW FEATURES (TUI, SLURM, Halt, Sweeps)
# ============================================================================
print_section R "v3.4.0 New Features (TUI, SLURM, Halt, Sweeps)"

# --- R1: TUI flag accepted and pipeline completes (headless safe) ---
# Even without a /dev/tty, frun should gracefully skip the TUI and run normally.
run_test_exact R "R1: TUI flag accepted and pipeline completes (headless safe)" \
"seq 10 | frun --tui -k printf '%s\n'" \
"$(seq 10)"

# --- R2: SLURM SIGUSR1 triggers checkpoint and exit 138 ---
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_SLURM"; mkdir -p "$_MD"
seq 10000 > "$_MD/input.txt"; rm -f "$_MD/.forkrun_resume"

# FIXED: Added -s so sleep reads from stdin and actually sleeps, keeping frun alive.
# Use pgrep to find the cleanroom bash (child of FPID) and signal it directly
bash -c "source '$FRUN_SOURCE'; cd '$_MD'; cat input.txt | FORKRUN_PREEMPT_MODE=1 frun -k -s -l 1 sleep 0.1 & FPID=\$!; sleep 0.3; CPID=\$(ps -o pid= --ppid \$FPID 2>/dev/null | tr -d ' '); [[ -n \"\$CPID\" ]] && (( CPID = CPID + 2 )) && kill -USR1 \$CPID; wait \$FPID" \
> "$_MD/output.txt" 2>"$_MD/err.txt"
_REXIT=$?

if (( _REXIT == 138 )) && [[ -f "$_MD/.forkrun_resume" ]] && grep -q "Caught SIGUSR1" "$_MD/err.txt"; then
TEST_RESULTS["R2: SLURM SIGUSR1 triggers checkpoint and exit 138"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R2: SLURM SIGUSR1 triggers checkpoint and exit 138"
else
TEST_RESULTS["R2: SLURM SIGUSR1 triggers checkpoint and exit 138"]="FAIL"
TEST_ERRORS["R2: SLURM SIGUSR1 triggers checkpoint and exit 138"]="exit=$_REXIT, cp=$([[ -f "$_MD/.forkrun_resume" ]] && echo yes || echo no), err=$(cat "$_MD/err.txt" | tail -1)"
((FAILED_TESTS++)); _print_result FAIL "R2: SLURM SIGUSR1 triggers checkpoint and exit 138" "exit=$_REXIT"

Check warning on line 2915 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R2: SLURM SIGUSR1 triggers checkpoint and exit 138' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l-&open=AZ9DCNDpTRWAAPg0D6l-&pullRequest=422
fi
fi

# --- R3: Auto halt on absolute fail count (--halt fail=2) ---
# (No changes - apply the forkrun_ring.c fix above to make this pass)
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_HALT1"; mkdir -p "$_MD"
cat > "$_MD/funcs.sh" << 'FUNCEOF'
crash_on_3_7() {
for a in "$@"; do
if [[ "$a" == "3" ]] || [[ "$a" == "7" ]]; then
exit 1
else
printf '%s\n' "$a"
fi
done
}
FUNCEOF

bash -c "source '$FRUN_SOURCE' && source '$_MD/funcs.sh' && seq 1 100 | FORKRUN_RETRY_LIMIT=0 FORKRUN_EXTRA_FUNCS='crash_on_3_7' frun -k -l 1 -E --halt fail=2 crash_on_3_7" \
> "$_MD/out.txt" 2>"$_MD/err.txt"
_RX=$?
_RERR=$(cat "$_MD/err.txt")

if (( _RX != 0 )) && echo "$_RERR" | grep -q "Halt condition met (2 failed batches)"; then
TEST_RESULTS["R3: Auto halt on absolute fail count (--halt fail=2)"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R3: Auto halt on absolute fail count (--halt fail=2)"
else
TEST_RESULTS["R3: Auto halt on absolute fail count (--halt fail=2)"]="FAIL"
TEST_ERRORS["R3: Auto halt on absolute fail count (--halt fail=2)"]="exit=$_RX, err=$(echo "$_RERR" | tail -1)"
((FAILED_TESTS++)); _print_result FAIL "R3: Auto halt on absolute fail count (--halt fail=2)" "exit=$_RX"

Check warning on line 2947 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R3: Auto halt on absolute fail count (--halt fail=2)' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l7&open=AZ9DCNDpTRWAAPg0D6l7&pullRequest=422
fi
fi

# --- R4: Auto halt on percentage (--halt fail=50%) ---
# FIXED: Moved FORKRUN_RETRY_LIMIT=0 to the frun side, increased lines to 1000 to trigger early.
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_HALT2"; mkdir -p "$_MD"
cat > "$_MD/funcs.sh" << 'FUNCEOF'
crash_even() {
for a in "$@"; do
if (( a % 3 != 0 )); then
exit 1
else
printf '%s\n' "$a"
fi
done
}
FUNCEOF

bash -c "source '$FRUN_SOURCE' && source '$_MD/funcs.sh' && seq 1 1000 | FORKRUN_EXTRA_FUNCS='crash_even' FORKRUN_RETRY_LIMIT=0 frun -k -l 1 -E --halt fail=50% crash_even" \
> "$_MD/out.txt" 2>"$_MD/err.txt"
_Rx=$?
_RERR=$(cat "$_MD/err.txt")

if (( _Rx != 0 )) && echo "$_RERR" | grep -q "Halt condition met (50% failed batches)"; then
TEST_RESULTS["R4: Auto halt on percentage (--halt fail=50%)"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R4: Auto halt on percentage (--halt fail=50%)"
else
TEST_RESULTS["R4: Auto halt on percentage (--halt fail=50%)"]="FAIL"
TEST_ERRORS["R4: Auto halt on percentage (--halt fail=50%)"]="exit=$_Rx, err=$(echo "$_RERR" | tail -1)"
((FAILED_TESTS++)); _print_result FAIL "R4: Auto halt on percentage (--halt fail=50%)" "exit=$_Rx"

Check warning on line 2979 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R4: Auto halt on percentage (--halt fail=50%)' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6mB&open=AZ9DCNDpTRWAAPg0D6mB&pullRequest=422
fi
fi

# --- R5: Sweep inline args (:::) with {1}-{2} substitution ---
if in_section R; then
((TOTAL_TESTS++))
_ROUT=$(bash -c "source '$FRUN_SOURCE' && frun echo {1}-{2} ::: a b c ::: 1 2 2>&1 | sort")
_REXP="a-1
a-2
b-1
b-2
c-1
c-2"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R5: Sweep inline args (:::) with {1}-{2}"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R5: Sweep inline args (:::) with {1}-{2}"
else
TEST_RESULTS["R5: Sweep inline args (:::) with {1}-{2}"]="FAIL"
TEST_ERRORS["R5: Sweep inline args (:::) with {1}-{2}"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R5: Sweep inline args (:::) with {1}-{2}" "output mismatch"

Check warning on line 2999 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R5: Sweep inline args (:::) with {1}-{2}' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l2&open=AZ9DCNDpTRWAAPg0D6l2&pullRequest=422
fi
fi

# --- R6: Sweep inline args (:::) default args ---
if in_section R; then
((TOTAL_TESTS++))
_ROUT=$(bash -c "source '$FRUN_SOURCE' && frun echo ::: a b c ::: 1 2 2>&1 | sort")
_REXP="a 1
a 2
b 1
b 2
c 1
c 2"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R6: Sweep inline args (:::) default args"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R6: Sweep inline args (:::) default args"
else
TEST_RESULTS["R6: Sweep inline args (:::) default args"]="FAIL"
TEST_ERRORS["R6: Sweep inline args (:::) default args"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R6: Sweep inline args (:::) default args" "output mismatch"

Check warning on line 3019 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R6: Sweep inline args (:::) default args' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l9&open=AZ9DCNDpTRWAAPg0D6l9&pullRequest=422
fi
fi

# --- R7: Sweep file args (::::) default args ---
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_SWEEP2"; mkdir -p "$_MD"
printf "x\ny\nz\n" > "$_MD/f1.txt"
printf "100\n200\n" > "$_MD/f2.txt"

_ROUT=$(bash -c "source '$FRUN_SOURCE' && frun echo :::: '$_MD/f1.txt' :::: '$_MD/f2.txt' 2>&1 | sort")
_REXP="x 100
x 200
y 100
y 200
z 100
z 200"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R7: Sweep file args (::::) default args"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R7: Sweep file args (::::) default args"
else
TEST_RESULTS["R7: Sweep file args (::::) default args"]="FAIL"
TEST_ERRORS["R7: Sweep file args (::::) default args"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R7: Sweep file args (::::) default args" "output mismatch"

Check warning on line 3043 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R7: Sweep file args (::::) default args' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l_&open=AZ9DCNDpTRWAAPg0D6l_&pullRequest=422
fi
fi

# --- R8: Sweep --link zip mode ---
if in_section R; then
((TOTAL_TESTS++))
_ROUT=$(bash -c "source '$FRUN_SOURCE' && frun --link echo ::: a b c ::: 1 2 3 2>&1 | sort")
_REXP="a 1
b 2
c 3"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R8: Sweep --link zip mode"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R8: Sweep --link zip mode"
else
TEST_RESULTS["R8: Sweep --link zip mode"]="FAIL"
TEST_ERRORS["R8: Sweep --link zip mode"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R8: Sweep --link zip mode" "output mismatch"

Check warning on line 3060 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R8: Sweep --link zip mode' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l3&open=AZ9DCNDpTRWAAPg0D6l3&pullRequest=422
fi
fi

# --- R9: Sweep with bash function ---
if in_section R; then
((TOTAL_TESTS++))
_ROUT=$(bash -c "source '$FRUN_SOURCE' && my_func() { echo \"\$1:\$2\"; }; frun my_func ::: a b ::: 1 2 2>&1 | sort" 2>/dev/null)
_REXP="a:1
a:2
b:1
b:2"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R9: Sweep with bash function"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R9: Sweep with bash function"
else
TEST_RESULTS["R9: Sweep with bash function"]="FAIL"
TEST_ERRORS["R9: Sweep with bash function"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R9: Sweep with bash function" "output mismatch"

Check warning on line 3078 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R9: Sweep with bash function' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l6&open=AZ9DCNDpTRWAAPg0D6l6&pullRequest=422
fi
fi

# --- R10: SLURM SIGTERM triggers checkpoint and exit 143 ---
# Verifies that standard SLURM scancel/preemption (SIGTERM) is caught and handled identically to SIGUSR1
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_SLURM_TERM"; mkdir -p "$_MD"
seq 10000 > "$_MD/input.txt"; rm -f "$_MD/.forkrun_resume"

bash -c "source '$FRUN_SOURCE'; cd '$_MD'; cat input.txt | FORKRUN_PREEMPT_MODE=1 frun -k -s -l 1 sleep 0.1 & FPID=\$!; sleep 0.3; CPID=\$(ps -o pid= --ppid \$FPID 2>/dev/null | tr -d ' '); [[ -n \"\$CPID\" ]] && (( CPID = CPID + 2 )) && kill -TERM \$CPID 2>/dev/null || kill -TERM \$FPID 2>/dev/null; wait \$FPID" \
> "$_MD/output.txt" 2>"$_MD/err.txt"
_REXIT=$?

if (( _REXIT == 143 )) && [[ -f "$_MD/.forkrun_resume" ]]; then
TEST_RESULTS["R10: SLURM SIGTERM triggers checkpoint and exit 143"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R10: SLURM SIGTERM triggers checkpoint and exit 143"
else
TEST_RESULTS["R10: SLURM SIGTERM triggers checkpoint and exit 143"]="FAIL"
TEST_ERRORS["R10: SLURM SIGTERM triggers checkpoint and exit 143"]="exit=$_REXIT, cp=$([[ -f "$_MD/.forkrun_resume" ]] && echo yes || echo no)"
((FAILED_TESTS++)); _print_result FAIL "R10: SLURM SIGTERM triggers checkpoint and exit 143" "exit=$_REXIT"

Check warning on line 3099 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R10: SLURM SIGTERM triggers checkpoint and exit 143' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l8&open=AZ9DCNDpTRWAAPg0D6l8&pullRequest=422
fi
fi

# --- R11: GNU Parallel Halt Syntax (--halt now,2) ---
# Verifies the C-level parser fix correctly identifies the "now," prefix without "fail="
if in_section R; then
((TOTAL_TESTS++))
_MD="$TEST_DIR/R_HALT3"; mkdir -p "$_MD"
cat > "$_MD/funcs.sh" << 'FUNCEOF'
crash_on_3_7() {
for a in "$@"; do
if [[ "$a" == "3" ]] || [[ "$a" == "7" ]]; then
exit 1
else
printf '%s\n' "$a"
fi
done
}
FUNCEOF

bash -c "source '$FRUN_SOURCE' && source '$_MD/funcs.sh' && seq 1 10 | FORKRUN_RETRY_LIMIT=0 FORKRUN_EXTRA_FUNCS='crash_on_3_7' frun -k -l 1 -E --halt now,2 crash_on_3_7" \
> "$_MD/out.txt" 2>"$_MD/err.txt"
_RX=$?
_RERR=$(cat "$_MD/err.txt")

if (( _RX != 0 )) && echo "$_RERR" | grep -q "Halt condition met (2 failed batches)"; then
TEST_RESULTS["R11: GNU Halt syntax (--halt now,2) triggers abort"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R11: GNU Halt syntax (--halt now,2) triggers abort"
else
TEST_RESULTS["R11: GNU Halt syntax (--halt now,2) triggers abort"]="FAIL"
TEST_ERRORS["R11: GNU Halt syntax (--halt now,2) triggers abort"]="exit=$_RX, err=$(echo "$_RERR" | tail -1)"
((FAILED_TESTS++)); _print_result FAIL "R11: GNU Halt syntax (--halt now,2) triggers abort" "exit=$_RX"

Check warning on line 3131 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R11: GNU Halt syntax (--halt now,2) triggers abort' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6mC&open=AZ9DCNDpTRWAAPg0D6mC&pullRequest=422
fi
fi

# --- R12: Sweep file args from stdin (:::: -) ---
# Verifies the mapfile /dev/stdin branch works perfectly
if in_section R; then
((TOTAL_TESTS++))
_ROUT=$(printf "x\ny\nz\n" | bash -c "source '$FRUN_SOURCE' && frun echo ::: a b :::: - 2>&1 | sort")
_REXP="a x
a y
a z
b x
b y
b z"
if [[ "$_ROUT" == "$_REXP" ]]; then
TEST_RESULTS["R12: Sweep file args from stdin (:::: -)"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R12: Sweep file args from stdin (:::: -)"
else
TEST_RESULTS["R12: Sweep file args from stdin (:::: -)"]="FAIL"
TEST_ERRORS["R12: Sweep file args from stdin (:::: -)"]="out: $_ROUT"
((FAILED_TESTS++)); _print_result FAIL "R12: Sweep file args from stdin (:::: -)" "output mismatch"

Check warning on line 3152 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R12: Sweep file args from stdin (:::: -)' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6mA&open=AZ9DCNDpTRWAAPg0D6mA&pullRequest=422

Check warning on line 3152 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'output mismatch' 10 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l5&open=AZ9DCNDpTRWAAPg0D6l5&pullRequest=422
fi
fi

# --- R13: Sweep --link zip mode truncates uneven arrays safely ---
# Verifies the bash orchestrator safely truncates to the shortest length and warns the user
if in_section R; then
((TOTAL_TESTS++))
bash -c "source '$FRUN_SOURCE' && frun --link echo ::: 1 2 3 4 ::: a b" > "$TEST_DIR/r13_out.txt" 2> "$TEST_DIR/r13_err.txt"
_ROUT=$(sort "$TEST_DIR/r13_out.txt")
_RERR=$(cat "$TEST_DIR/r13_err.txt")
_REXP="1 a
2 b"

# FIXED: Added -i to grep to handle the capital 'T' in "Truncating"
if [[ "$_ROUT" == "$_REXP" ]] && echo "$_RERR" | grep -qi "truncating combinations to the shortest length (2)"; then
TEST_RESULTS["R13: Sweep --link truncates uneven arrays safely"]="PASS"; ((PASSED_TESTS++))
_print_result PASS "R13: Sweep --link truncates uneven arrays safely"
else
TEST_RESULTS["R13: Sweep --link truncates uneven arrays safely"]="FAIL"
TEST_ERRORS["R13: Sweep --link truncates uneven arrays safely"]="out: $_ROUT, err: $_RERR"
((FAILED_TESTS++)); _print_result FAIL "R13: Sweep --link truncates uneven arrays safely" "output or warning mismatch"

Check warning on line 3173 in UNIT_TESTS/test_frun_comprehensive.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'R13: Sweep --link truncates uneven arrays safely' 5 times.

See more on https://sonarcloud.io/project/issues?id=jkool702_forkrun&issues=AZ9DCNDpTRWAAPg0D6l4&open=AZ9DCNDpTRWAAPg0D6l4&pullRequest=422
fi
fi

# ============================================================================
# SUMMARY
# ============================================================================
Expand Down
Loading
Loading