File size: 3,657 Bytes
ef987bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
set -euo pipefail
set +e
TASK_ID='52'
TEST_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$TEST_DIR/_shared/static_enhancer.sh"
OFFLINE_PYTHONPATH="$TEST_DIR/_offline${PYTHONPATH:+:$PYTHONPATH}"
RUN_ENV=(env PYTHONHASHSEED=0 PYTHONPATH="$OFFLINE_PYTHONPATH" HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 WANDB_MODE=offline NO_PROXY='' HTTP_PROXY='http://127.0.0.1:9' HTTPS_PROXY='http://127.0.0.1:9' ALL_PROXY='http://127.0.0.1:9')
LOG_DIR="/logs/verifier"
if ! mkdir -p "$LOG_DIR" 2>/dev/null; then LOG_DIR="logs/verifier"; mkdir -p "$LOG_DIR"; fi
REWARD_FILE="$LOG_DIR/reward.txt"
PASS=1
CHECKS=0
FAILS=0

note() { echo "[Task $TASK_ID] $*"; }
fail() { note "FAIL: $*"; PASS=0; FAILS=$((FAILS+1)); }
check() { CHECKS=$((CHECKS+1)); "$@"; local code=$?; if [ $code -ne 0 ]; then fail "$*"; fi; }
have_any() { local pattern="$1"; compgen -G "$pattern" >/dev/null 2>&1; }
grep_any() { local pattern="$1"; shift; grep -REiq -- "$pattern" "$@" 2>/dev/null; }
source_files() { find . -type f \( -name '*.html' -o -name '*.js' -o -name '*.jsx' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' -o -name '*.py' -o -name '*.go' -o -name '*.swift' -o -name '*.svg' \) ! -path './tests/*' ! -path './logs/*'; }

note "enhanced deterministic verifier start"
static_enhance_check "${TASK_ID}" "$(pwd)"
if [ ! -e 'data/dataset/000001.jpg' ]; then
  fail "benchmark input asset missing: data/dataset/000001.jpg"
fi
if [ ! -e 'data/dataset/000001.txt' ]; then
  fail "benchmark input asset missing: data/dataset/000001.txt"
fi
if [ ! -e 'data/dataset/000002.jpg' ]; then
  fail "benchmark input asset missing: data/dataset/000002.jpg"
fi
if [ ! -e 'data/dataset/000002.txt' ]; then
  fail "benchmark input asset missing: data/dataset/000002.txt"
fi
if [ ! -e 'data/dataset/000003.jpg' ]; then
  fail "benchmark input asset missing: data/dataset/000003.jpg"
fi
if [ ! -e 'data/dataset/000003.txt' ]; then
  fail "benchmark input asset missing: data/dataset/000003.txt"
fi
if [ ! -e 'data/dataset/000004.jpg' ]; then
  fail "benchmark input asset missing: data/dataset/000004.jpg"
fi
if [ ! -e 'data/dataset/000004.txt' ]; then
  fail "benchmark input asset missing: data/dataset/000004.txt"
fi
mapfile -t py_files < <(find . -type f -name '*.py' ! -path './tests/*')
if [ ${#py_files[@]} -eq 0 ]; then fail "no Python source found"; fi
if command -v python3 >/dev/null 2>&1; then
  for f in "${py_files[@]}"; do timeout 30s "${RUN_ENV[@]}" python3 -m py_compile "$f" >/tmp/harbor_py_compile.log 2>&1 || fail "python compile failed: $f"; done
fi
if command -v python3 >/dev/null 2>&1; then
  check test -s solve.py
  timeout 60s "${RUN_ENV[@]}" python3 solve.py >/tmp/harbor_data_run.log 2>&1 || fail "solve.py did not run successfully"
fi
check test -s 'dataloader_demo.py'
check test -s 'distributed_demo.py'
check test -s 'score.txt'
check test -s 'shards/dataset-000000.tar'

if command -v python3 >/dev/null 2>&1; then
  check timeout 180s "${RUN_ENV[@]}" python3 "$TEST_DIR/validate_outputs.py"
  check timeout 180s "${RUN_ENV[@]}" python3 "$TEST_DIR/validate_enhanced.py"
else
  fail "python3 unavailable for output validation"
fi
# BEGIN AAAV_DYNAMIC_TEST
if [ -f "$TEST_DIR/validate_aaav_dynamic.js" ]; then
  if command -v node >/dev/null 2>&1; then
    check timeout 90s "${RUN_ENV[@]}" node "$TEST_DIR/validate_aaav_dynamic.js"
  else
    note "AAAV dynamic validation skipped (node unavailable in this runtime)"
  fi
fi
# END AAAV_DYNAMIC_TEST
check python3 "$TEST_DIR/review_ranks.py"
note "checks=$CHECKS fails=$FAILS"
if [ "$PASS" -eq 1 ]; then
  echo 1 > "$REWARD_FILE"
  note "PASS"
  exit 0
fi
echo 0 > "$REWARD_FILE"
note "FAIL"
exit 0