-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
40 lines (32 loc) · 1.29 KB
/
run.sh
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
#!/bin/bash
# TEST_DIRS=("single_card" "dual_cards")
# TEST_DIRS=("single_card")
# TEST_DIRS=("single_card/qwen1.5-14b" "single_card/chatglm4-9b/" "dual_cards/chatglm4-9b/" "single_card/chatglm3-6b/" "single_card/llama2-13b/" "dual_cards/qwen1.5-14b/" "dual_cards/llama2-13b/" "dual_cards/chatglm3-6b/")
TEST_DIRS=("dual_cards/llama2-7b/" "single_card/llama2-7b")
LOG_DIR="logs"
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR"
fi
for TEST_DIR in "${TEST_DIRS[@]}"; do
if [ ! -d "$TEST_DIR" ]; then
echo "Directory $TEST_DIR does not exist."
continue
fi
for SCRIPT in "$TEST_DIR"/*.sh; do
if [ ! -f "$SCRIPT" ]; then
continue
fi
SCRIPT_NAME=$(basename "$SCRIPT")
PARENT_DIR=$(basename "$(dirname "$TEST_DIR")")
CURRENT_DIR=$(basename "$TEST_DIR")
LOG_FILE="${LOG_DIR}/${PARENT_DIR}_${CURRENT_DIR}_${SCRIPT_NAME}.log"
echo "Running $SCRIPT, logging to $LOG_FILE..."
echo "### Script Content: ${SCRIPT}" > "$LOG_FILE"
cat "$SCRIPT" >> "$LOG_FILE"
echo -e "\n### Script Output:\n" >> "$LOG_FILE"
bash "$SCRIPT" 2>&1 | tee -a "$LOG_FILE"
echo "$SCRIPT finished. Output logged to $LOG_FILE"
echo
done
done
echo "All scripts in specified directories have been run."