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+ }
0 commit comments