-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.sh
More file actions
executable file
·169 lines (144 loc) · 5.67 KB
/
run_all.sh
File metadata and controls
executable file
·169 lines (144 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
set -e
###############################################################################
# run_all.sh -- Full rebuild and verification of all validation results
#
# This script re-runs every validation and analysis script that underpins the
# paper's claims, captures pass/fail status for each, then generates SHA-256
# checksums of every results file so that outputs are reproducible and
# auditable.
#
# Usage: ./run_all.sh (from the Paper directory, or anywhere)
###############################################################################
# ---------------------------------------------------------------------------
# 0. Resolve the Paper directory from this script's own location
# ---------------------------------------------------------------------------
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
# ---------------------------------------------------------------------------
# 1. Header
# ---------------------------------------------------------------------------
echo "==========================================================================="
echo " Voynich Manuscript Decoding -- Full Validation Rebuild"
echo "==========================================================================="
echo ""
echo " Paper directory : $DIR"
echo " Date : $(date '+%Y-%m-%d %H:%M:%S %Z')"
echo " Python : $(python3 --version 2>&1)"
echo ""
echo " This script runs every validation and analysis script in scripts/,"
echo " reports PASS/FAIL for each, and writes SHA-256 checksums of all"
echo " result files to results/CHECKSUMS.sha256."
echo ""
echo "==========================================================================="
echo ""
# ---------------------------------------------------------------------------
# 2. Define the ordered list of scripts to run
# ---------------------------------------------------------------------------
SCRIPTS=(
"scripts/validate_coverage.py"
"scripts/validate_vowel_final.py"
"scripts/validate_phonotactics.py"
"scripts/validate_domain_clustering.py"
"scripts/validate_external_pharma.py"
"scripts/keyword_section_clustering.py"
"scripts/sov_syntax_test.py"
"scripts/collocation_test.py"
"scripts/dual_null_model_test.py"
"scripts/stability_robustness_test.py"
"scripts/multiple_testing_correction.py"
"scripts/holdout_validation.py"
)
# Scripts that are known to be long-running
declare -A SLOW_SCRIPTS
SLOW_SCRIPTS["scripts/dual_null_model_test.py"]=1
SLOW_SCRIPTS["scripts/stability_robustness_test.py"]=1
# ---------------------------------------------------------------------------
# 3. Run each script, track results
# ---------------------------------------------------------------------------
TOTAL=0
PASSED=0
FAILED=0
SKIPPED=0
FAILED_NAMES=()
for script in "${SCRIPTS[@]}"; do
# Check existence first
if [[ ! -f "$DIR/$script" ]]; then
echo " WARNING: $script not found -- skipping"
echo ""
SKIPPED=$((SKIPPED + 1))
continue
fi
TOTAL=$((TOTAL + 1))
echo "-------------------------------------------------------------------"
echo " Running: $script"
# Print slow-script advisory
if [[ -n "${SLOW_SCRIPTS[$script]+_}" ]]; then
echo " NOTE: This script may take several minutes (long-running test)."
fi
echo "-------------------------------------------------------------------"
# Run the script; capture exit code without letting set -e kill us
set +e
python3 "$DIR/$script"
EXIT_CODE=$?
set -e
if [[ $EXIT_CODE -eq 0 ]]; then
echo ""
echo " >>> PASS: $script (exit code 0)"
PASSED=$((PASSED + 1))
else
echo ""
echo " >>> FAIL: $script (exit code $EXIT_CODE)"
FAILED=$((FAILED + 1))
FAILED_NAMES+=("$script")
fi
echo ""
done
# ---------------------------------------------------------------------------
# 4. Generate SHA-256 checksums for every file in results/
# ---------------------------------------------------------------------------
echo "==========================================================================="
echo " Generating SHA-256 checksums for results/"
echo "==========================================================================="
echo ""
mkdir -p "$DIR/results"
# Remove old checksums file so it is not included in its own checksum
rm -f "$DIR/results/CHECKSUMS.sha256"
# Only checksum if there are files present
RESULT_FILES=("$DIR"/results/*.txt)
if [[ -e "${RESULT_FILES[0]}" ]]; then
sha256sum "$DIR"/results/*.txt > "$DIR/results/CHECKSUMS.sha256"
echo " Checksums written to: $DIR/results/CHECKSUMS.sha256"
else
echo " WARNING: No .txt files found in results/ -- no checksums generated."
fi
echo ""
# ---------------------------------------------------------------------------
# 5. Summary
# ---------------------------------------------------------------------------
TIMESTAMP="$(date '+%Y-%m-%d %H:%M:%S %Z')"
echo "==========================================================================="
echo " SUMMARY"
echo "==========================================================================="
echo ""
echo " Total scripts run : $TOTAL"
echo " Passed : $PASSED"
echo " Failed : $FAILED"
echo " Skipped (missing) : $SKIPPED"
echo ""
if [[ $FAILED -gt 0 ]]; then
echo " Failed scripts:"
for name in "${FAILED_NAMES[@]}"; do
echo " - $name"
done
echo ""
fi
echo " Checksums file : $DIR/results/CHECKSUMS.sha256"
echo " Completed at : $TIMESTAMP"
echo ""
echo "==========================================================================="
# Exit with non-zero status if any script failed
if [[ $FAILED -gt 0 ]]; then
exit 1
fi
exit 0