Skip to content

Commit e35560f

Browse files
committed
changes for windows test
1 parent 0fc4923 commit e35560f

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

test/test_c.sh

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
# Configuration
45
EXE="./bin/loco"
5-
# This is the output file name loco usually generates (adjust if loco adds suffixes)
66
OUT_FILE="bin/test_c_laplacian.tsv"
77
TOTAL_RUNS=5
88
REQUIRED_PASSES=4
99
PASS_COUNT=0
1010

11-
# The command to run
1211
CMD="$EXE -i ./test/simulatedData3.tsv -o bin -p test_c -c -n 20 -s 100 -x 0.5 -t 50 -q 2 -m 2 -a 0.01"
1312

1413
check_output() {
15-
# If the file doesn't even exist, fail immediately
16-
if [ ! -f "$1" ]; then return 1; fi
17-
18-
# awk logic:
19-
# NR > 1 && NR <= 6: Check only the first 5 data rows
20-
# $3 < 0.05 and $5 < 0.05: Verify p-values
21-
# $6 == "A,B,C,D,E": Verify the clique column
22-
# $1 ~ /^[ABCDE]_[ABCDE]$/: Verify ProteinPair only contains A,B,C,D,E
14+
if [ ! -f "$1" ]; then
15+
return 1
16+
fi
17+
2318
awk -F'\t' '
2419
NR > 1 && NR <= 6 {
25-
if ($3 >= 0.01 || $5 >= 0.01) exit 1
20+
gsub(/\r/, "", $0)
21+
22+
if ($3 >= 0.01 || $5 >= 0.01) exit 1
2623
if ($6 != "A,B,C,D,E") exit 1
2724
if ($1 !~ /^[ABCDE]_[ABCDE]$/) exit 1
2825
}
@@ -31,25 +28,29 @@ check_output() {
3128

3229
echo "Starting $TOTAL_RUNS iterations of Loco..."
3330

34-
for i in $(seq 1 $TOTAL_RUNS); do
31+
# ✅ POSIX-safe loop (NO seq!)
32+
i=1
33+
while [ "$i" -le "$TOTAL_RUNS" ]; do
3534
echo -n "Run $i: Executing... "
36-
37-
# Execute the loco command (silencing stdout to keep logs clean)
38-
$CMD > /dev/null 2>&1
39-
35+
36+
# run silently
37+
$CMD > /dev/null 2>&1 || true
38+
4039
if check_output "$OUT_FILE"; then
41-
((PASS_COUNT++))
40+
PASS_COUNT=$((PASS_COUNT + 1))
4241
echo "VALID"
4342
else
44-
echo "INVALID (Criteria not met or file missing)"
43+
echo "INVALID"
4544
fi
45+
46+
i=$((i + 1))
4647
done
4748

4849
echo "---------------------------------------"
4950
echo "Results: $PASS_COUNT / $TOTAL_RUNS passed."
5051

5152
if [ "$PASS_COUNT" -ge "$REQUIRED_PASSES" ]; then
52-
echo "OVERALL SUCCESS: Quality threshold ($REQUIRED_PASSES/$TOTAL_RUNS) met."
53+
echo "OVERALL SUCCESS: Quality threshold met."
5354
exit 0
5455
else
5556
echo "OVERALL FAILURE: Logic check failed."

0 commit comments

Comments
 (0)