Skip to content

Commit cc3fd6a

Browse files
fix hb function bug
1 parent 270621f commit cc3fd6a

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
obj/
22
traces/
3+
witness/
34
predictor
45
run_tests
56
.vscode/

scripts/runner.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
4+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
5+
TRACES_DIR="$PROJECT_DIR/traces"
6+
PROGRAM="$PROJECT_DIR/predictor"
7+
8+
TIMEOUT=600
9+
10+
if [ ! -f "$PROGRAM" ]; then
11+
echo "Error: $PROGRAM not found"
12+
exit 1
13+
fi
14+
15+
BENCHMARK_TRACES=(
16+
# "cryptorsa"
17+
# "linkedlist"
18+
# "lusearch"
19+
# "xalan"
20+
# "bufwriter"
21+
# "moldyn"
22+
# "readerswriters"
23+
# "ftpserver"
24+
# "derby"
25+
"jigsaw"
26+
"account"
27+
"airlinetickets"
28+
"array"
29+
"boundedbuffer"
30+
"bubblesort"
31+
"clean"
32+
"critical"
33+
"lang"
34+
"mergesort"
35+
"pingpong"
36+
"producerconsumer"
37+
"raytracer"
38+
"twostage"
39+
"wronglock"
40+
)
41+
42+
for trace in "${BENCHMARK_TRACES[@]}"; do
43+
44+
if [ ! -f "$TRACES_DIR/$trace" ]; then
45+
echo "Error: $trace not found"
46+
continue
47+
fi
48+
49+
echo "Running $trace"
50+
gtimeout $TIMEOUT "$PROGRAM" -f "$TRACES_DIR/$trace" 2>&1
51+
EXIT_CODE=$?
52+
53+
if [ $EXIT_CODE -eq 124 ]; then
54+
echo "Error: $trace timed out"
55+
continue
56+
elif [ $EXIT_CODE -ne 0 ]; then
57+
echo "Error: $trace failed with exit code $EXIT_CODE"
58+
continue
59+
fi
60+
done

src/casual_model.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,15 @@ uint32_t CasualModel::solve() {
253253
z3::expr_vector race_sat(c_);
254254
race_sat.push_back(race_con);
255255

256+
auto [e1, e2] = filtered_cop_events_[i];
257+
256258
if (s_.check(race_sat) == z3::sat) {
257259
race_count++;
258-
259260
if (log_witness_) {
260-
auto [e1, e2] = filtered_cop_events_[i];
261261
logger_.logWitnessPrefix(s_.get_model(), e1, e2);
262262
}
263263
}
264+
264265
i++;
265266
}
266267

src/casual_model.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <utility>
55
#include <vector>
66

7+
#include "BSlogger.hpp"
78
#include "event.h"
89
#include "lockset_engine.h"
910
#include "trace.h"
@@ -54,7 +55,7 @@ class CasualModel {
5455

5556
inline bool hb(const Event& e1, const Event& e2) {
5657
return mhb_closure_.happensBefore(e1, e2) ||
57-
(e1.getTargetId() == e2.getTargetId() &&
58+
(e1.getThreadId() == e2.getThreadId() &&
5859
e1.getEventId() < e2.getEventId());
5960
}
6061

0 commit comments

Comments
 (0)