-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrq5.sh
More file actions
executable file
·156 lines (136 loc) · 4.75 KB
/
rq5.sh
File metadata and controls
executable file
·156 lines (136 loc) · 4.75 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
#!/bin/bash
# RQ5: Experiments on OSS-Fuzz
# Evaluates ReduceFix on real OSS-Fuzz crash instances
# Usage: ./rq5.sh [--run] [--regenerate] [--timeout <seconds>]
set -e
RUN_EXPERIMENT=false
REGENERATE_FLAG=""
TIMEOUT=600
MODEL="qwen-plus"
REPAIR_MODEL="qwen-plus"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--run)
RUN_EXPERIMENT=true
shift
;;
--regenerate)
REGENERATE_FLAG="--regenerate"
shift
;;
--timeout)
TIMEOUT="$2"
shift 2
;;
--model)
MODEL="$2"
shift 2
;;
--repair-model)
REPAIR_MODEL="$2"
shift 2
;;
-h|--help)
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --run Run complete experiment (Build + Reduce + Repair)"
echo " --regenerate Regenerate statistics"
echo " --timeout <sec> Reduction timeout in seconds (default: 600)"
echo " --model <name> Reducer model (default: qwen-plus)"
echo " --repair-model <n> Repair model (default: qwen-plus)"
echo " -h, --help Show this help"
echo ""
echo "Examples:"
echo " $0 # Display existing results only"
echo " $0 --run # Run complete experiment (12 cases)"
echo " $0 --run --timeout 900 # Run with 15min timeout"
echo " $0 --regenerate # Regenerate statistics"
exit 0
;;
*)
echo "Unknown option: $1" >&2
echo "Use --help for usage information" >&2
exit 1
;;
esac
done
echo ""
echo "=============================================="
echo "RQ5: OSS-Fuzz Evaluation Results"
echo "=============================================="
echo ""
# Step 1: Run experiment if requested
if [ "$RUN_EXPERIMENT" = true ]; then
echo "Mode: Running complete experiment"
echo "=============================================="
echo "Total cases: 12 (from cases.json)"
echo "Timeout: ${TIMEOUT} seconds per reduction"
echo "Reducer model: ${MODEL}"
echo "Repair model: ${REPAIR_MODEL}"
echo ""
# Record start time
START_TIME=$(date +%s)
# Run complete ReduceFix experiment (Build + Reduce + Repair)
echo "Starting complete ReduceFix experiment..."
echo "This will:"
echo " 1. Build Reducers for each project (one-time per project)"
echo " 2. Reduce test cases with 3 algorithms (DDMin, ReduceFix, LLM-Generated)"
echo " 3. Repair bugs with 3 strategies (no_tc, orig_tc, reduced_tc)"
echo ""
./oss_fuzz_results/run_ossfuzz.sh \
--all \
--model "${MODEL}" \
--repair-model "${REPAIR_MODEL}" \
--timeout "${TIMEOUT}"
# Calculate elapsed time
END_TIME=$(date +%s)
ELAPSED=$((END_TIME - START_TIME))
HOURS=$((ELAPSED / 3600))
MINUTES=$(((ELAPSED % 3600) / 60))
SECONDS=$((ELAPSED % 60))
echo ""
echo "=============================================="
echo "Experiment completed!"
echo "Total time: ${HOURS}h ${MINUTES}m ${SECONDS}s"
echo "=============================================="
echo ""
fi
# Step 2: Generate or use existing statistics
OVERVIEW_FILE="oss_fuzz_results/experiment_results/experiment_overview.json"
if [[ -f "$OVERVIEW_FILE" ]] && [[ -z "$REGENERATE_FLAG" ]] && [ "$RUN_EXPERIMENT" = false ]; then
echo "Mode: Analysis only (using existing experiment_overview.json)"
echo "=============================================="
echo ""
else
if [[ -n "$REGENERATE_FLAG" ]]; then
echo "Mode: Regenerating statistics"
elif [ "$RUN_EXPERIMENT" = true ]; then
echo "Mode: Generating statistics from new experiment results"
else
echo "Mode: Generating statistics (experiment_overview.json not found)"
fi
echo "=============================================="
echo ""
# Run experiment statistics generation
echo "Generating experiment statistics..."
echo ""
cd oss_fuzz_results
python3 compute_experiment_stats.py --model-tag reducefix_${MODEL//-/_} --no-details
cd ..
echo ""
echo "Statistics generation complete."
echo ""
fi
# Step 3: Display results (recalculate pass@k from scratch)
echo "=============================================="
echo "Displaying RQ5 Results (Recalculating Pass@K)"
echo "=============================================="
echo ""
cd oss_fuzz_results
python3 compute_experiment_stats.py --model-tag reducefix_${MODEL//-/_} --paper-format --no-details
cd ..
echo ""
echo "RQ5 analysis complete."
echo ""