Skip to content

Commit 080770f

Browse files
Add libvsync tests (#618)
* Add libvsync tests Signed-off-by: Hernan Ponce de Leon <[email protected]>
1 parent 32e10c8 commit 080770f

16 files changed

+11392
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.dat3m.dartagnan.c;
2+
3+
import com.dat3m.dartagnan.configuration.Arch;
4+
import com.dat3m.dartagnan.configuration.OptionNames;
5+
import com.dat3m.dartagnan.configuration.Property;
6+
import com.dat3m.dartagnan.parsers.cat.ParserCat;
7+
import com.dat3m.dartagnan.utils.Result;
8+
import com.dat3m.dartagnan.utils.rules.Provider;
9+
import com.dat3m.dartagnan.verification.solving.RefinementSolver;
10+
import com.dat3m.dartagnan.wmm.Wmm;
11+
import org.junit.Test;
12+
import org.junit.runner.RunWith;
13+
import org.junit.runners.Parameterized;
14+
import org.sosy_lab.common.configuration.Configuration;
15+
16+
import java.io.File;
17+
import java.io.IOException;
18+
import java.util.Arrays;
19+
import java.util.EnumSet;
20+
21+
import static com.dat3m.dartagnan.configuration.Arch.IMM;
22+
import static com.dat3m.dartagnan.utils.ResourceHelper.getRootPath;
23+
import static com.dat3m.dartagnan.utils.ResourceHelper.getTestResourcePath;
24+
import static com.dat3m.dartagnan.utils.Result.UNKNOWN;
25+
import static com.dat3m.dartagnan.utils.Result.PASS;
26+
import static org.junit.Assert.assertEquals;
27+
28+
@RunWith(Parameterized.class)
29+
public class LibvsyncTest extends AbstractCTest {
30+
31+
public LibvsyncTest(String name, Arch target, Result expected) {
32+
super(name, target, expected);
33+
}
34+
35+
@Override
36+
protected Provider<String> getProgramPathProvider() {
37+
return Provider.fromSupplier(() -> getTestResourcePath("libvsync/" + name + "-opt.ll"));
38+
}
39+
40+
@Override
41+
protected long getTimeout() {
42+
return 300000;
43+
}
44+
45+
@Override
46+
protected Provider<EnumSet<Property>> getPropertyProvider() {
47+
return Provider.fromSupplier(() -> EnumSet.of(Property.PROGRAM_SPEC, Property.LIVENESS));
48+
}
49+
50+
@Override
51+
protected Provider<Wmm> getWmmProvider() {
52+
return Provider.fromSupplier(() -> new ParserCat().parse(new File(getRootPath("cat/imm.cat"))));
53+
}
54+
55+
protected Provider<Configuration> getConfigurationProvider() {
56+
return Provider.fromSupplier(() -> Configuration.builder()
57+
.setOption(OptionNames.SOLVER, "yices2")
58+
.build());
59+
}
60+
61+
@Parameterized.Parameters(name = "{index}: {0}, target={1}")
62+
public static Iterable<Object[]> data() throws IOException {
63+
return Arrays.asList(new Object[][]{
64+
{"caslock", IMM, UNKNOWN},
65+
{"mcslock", IMM, UNKNOWN},
66+
{"rec_mcslock", IMM, UNKNOWN},
67+
{"rec_spinlock", IMM, UNKNOWN},
68+
{"rec_ticketlock", IMM, UNKNOWN},
69+
{"rwlock", IMM, UNKNOWN},
70+
{"semaphore", IMM, UNKNOWN},
71+
{"seqcount", IMM, PASS},
72+
{"seqlock", IMM, UNKNOWN},
73+
{"ticketlock", IMM, UNKNOWN},
74+
{"ttaslock", IMM, UNKNOWN},
75+
{"bounded_mpmc_check_empty", IMM, UNKNOWN},
76+
{"bounded_mpmc_check_full", IMM, UNKNOWN},
77+
{"bounded_spsc", IMM, UNKNOWN},
78+
});
79+
}
80+
81+
@Test
82+
public void testRefinement() throws Exception {
83+
RefinementSolver s = RefinementSolver.run(contextProvider.get(), proverProvider.get(), taskProvider.get());
84+
assertEquals(expected, s.getResult());
85+
}
86+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
These benchmarks where generated from [libvsync](https://github.com/open-s4c/libvsync) with commit id [4f990c4a1f22905405cbf8310eb450b9df86c5dd](https://github.com/open-s4c/libvsync/commit/4f990c4a1f22905405cbf8310eb450b9df86c5dd).
2+
3+
- caslock
4+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/caslock.c)
5+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/caslock.h)
6+
7+
- msclock
8+
- [clien-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/mcslock.c)
9+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/mcslock.h)
10+
11+
- rec_mcslock
12+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/rec_mcslock.c)
13+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/rec_mcslock.h)
14+
15+
- rec_spinlock
16+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/rec_spinlock.c)
17+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/rec_spinlock.h)
18+
19+
- rec_ticketlock
20+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/rec_ticketlock.c)
21+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/rec_ticketlock.h)
22+
23+
- rwlock
24+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/rwlock.c)
25+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/rwlock.h)
26+
27+
- semaphore
28+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/semaphore.c)
29+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/semaphore.h)
30+
31+
- seqcount
32+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/seqcount.c)
33+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/seqcount.h)
34+
35+
- caslock
36+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/seqlock.c)
37+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/seqlock.h)
38+
39+
- ticketlock
40+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/ticketlock.c)
41+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/ticketlock.h)
42+
43+
- ttaslock
44+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/spinlock/ttaslock.c)
45+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/spinlock/ttaslock.h)
46+
47+
- bounded_spsc
48+
- [client-code](https://github.com/open-s4c/libvsync/blob/main/test/queue/bounded_spsc.c)
49+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/queue/bounded_spsc.h)
50+
51+
- bounded_mpmc
52+
- [client-code (empty)](https://github.com/open-s4c/libvsync/blob/main/test/queue/bounded_mpmc_check_empty.c)
53+
- [client-code (full)](https://github.com/open-s4c/libvsync/blob/main/test/queue/bounded_mpmc_check_full.c)
54+
- [API](https://github.com/open-s4c/libvsync/blob/main/include/vsync/queue/bounded_mpmc.h)
55+
56+
57+
58+
59+
60+
61+
62+

0 commit comments

Comments
 (0)