From: weiyu Date: Mon, 24 Jun 2019 19:45:32 +0000 (-0700) Subject: update test cases X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=dffb384bcb02c12ae7cca965ab75c4a4b2336d7f update test cases --- diff --git a/libcdsTest/ms-queue/Makefile b/libcdsTest/ms-queue/Makefile index 8df2ca5f..a2b45572 100644 --- a/libcdsTest/ms-queue/Makefile +++ b/libcdsTest/ms-queue/Makefile @@ -1,15 +1,21 @@ all: intrusive_msqueue_hp.o +CXX = clang++ + #%.o : %.cc # $(CXX) -c $@ -CFLAGS=-I. -I /scratch/benchmarks/libcds -std=c++11 +INCLUDE = -I. -I /scratch/benchmarks/libcds + +INCLUDE += -Xclang -load -Xclang /scratch/llvm/build/lib/libCDSPass.so -I. -I /scratch/benchmarks/libcds + +CPPFLAGS = $(INCLUDE) -g -O1 -std=c++11 CDSDIR=/scratch/benchmarks/libcds/build-release/bin CDSLIB=-lcds_d -lpthread intrusive_msqueue_hp.o: intrusive_msqueue_hp.cc - $(CXX) -o msqueue intrusive_msqueue_hp.cc $(CFLAGS) -L $(CDSDIR) $(CDSLIB) + $(CXX) -o msqueue intrusive_msqueue_hp.cc $(CPPFLAGS) -L $(CDSDIR) $(CDSLIB) clean: rm -f *.o diff --git a/libcdsTest/ms-queue/intrusive_msqueue_hp.cc b/libcdsTest/ms-queue/intrusive_msqueue_hp.cc index 176ba500..88861fd7 100644 --- a/libcdsTest/ms-queue/intrusive_msqueue_hp.cc +++ b/libcdsTest/ms-queue/intrusive_msqueue_hp.cc @@ -19,6 +19,8 @@ typedef typename base_class::member_hook_item< ci::msqueue::node> membe typedef cds_test::intrusive_msqueue::mock_disposer mock_disposer; +std::atomic_int x; + template void test_enqueue( Queue& q, Data& arr ) { @@ -26,9 +28,15 @@ void test_enqueue( Queue& q, Data& arr ) size_t nSize = arr.size(); value_type * pv; - for ( size_t i = 0; i < nSize; ++i ) - arr[i].nVal = static_cast(i); - +// for ( size_t i = 0; i < nSize; ++i ) +// arr[i].nVal = static_cast(i); + + base_item_type test; + test.nVal = static_cast(4); +// arr[0].nVal = static_cast(5); + x.load(); + q.enqueue( test ); +/* assert(q.empty()); assert(q.size() == 0); @@ -42,7 +50,8 @@ void test_enqueue( Queue& q, Data& arr ) assert( pv == nullptr ); assert( q.empty()); assert(q.size() == 0); - +*/ +/* for ( size_t i = 0; i < nSize; ++i ) { if ( i & 1 ) q.push( arr[i] ); @@ -51,6 +60,7 @@ void test_enqueue( Queue& q, Data& arr ) assert( !q.empty()); assert(q.size() == i+1); } +*/ } @@ -61,34 +71,6 @@ void test_dequeue( Queue& q, Data& arr ) size_t nSize = arr.size(); value_type * pv; -/* - for ( size_t i = 0; i < nSize; ++i ) - arr[i].nVal = static_cast(i); - - assert(q.empty()); - assert(q.size() == 0); - - // pop from empty queue - pv = q.pop(); - assert( pv == nullptr ); - assert( q.empty()); - assert(q.size() == 0); - - pv = q.dequeue(); - assert( pv == nullptr ); - assert( q.empty()); - assert(q.size() == 0); - - // push/pop test - for ( size_t i = 0; i < nSize; ++i ) { - if ( i & 1 ) - q.push( arr[i] ); - else - q.enqueue( arr[i] ); - assert( !q.empty()); - assert(q.size() == i+1); - } -*/ for ( size_t i = 0; i < nSize; ++i ) { assert( !q.empty()); @@ -152,15 +134,14 @@ int main () { std::vector arr; arr.resize(5); printf("test start\n"); - { - std::atomic x; - atomic_store_explicit(&x, 0xaaa, std::memory_order_seq_cst); - test_queue q; - test_enqueue(q, arr); - atomic_store_explicit(&x, 0xccc, std::memory_order_seq_cst); - test_dequeue(q, arr); - atomic_store_explicit(&x, 0xbbb, std::memory_order_seq_cst); - } + + atomic_store_explicit(&x, 0xaaa, std::memory_order_seq_cst); + test_queue q; + test_enqueue(q, arr); + atomic_store_explicit(&x, 0xccc, std::memory_order_seq_cst); +// test_dequeue(q, arr); + atomic_store_explicit(&x, 0xbbb, std::memory_order_seq_cst); + printf("test end\n"); // gc_type::scan(); diff --git a/libcdsTest/ms-queue/msqueue2 b/libcdsTest/ms-queue/msqueue2 index ded5d2a0..c6121b20 100755 Binary files a/libcdsTest/ms-queue/msqueue2 and b/libcdsTest/ms-queue/msqueue2 differ diff --git a/libcdsTest/ms-queue/other b/libcdsTest/ms-queue/other deleted file mode 100755 index e6da92d6..00000000 Binary files a/libcdsTest/ms-queue/other and /dev/null differ diff --git a/libcdsTest/ms-queue/script.sh b/libcdsTest/ms-queue/script.sh index 9aa72536..6080cb79 100755 --- a/libcdsTest/ms-queue/script.sh +++ b/libcdsTest/ms-queue/script.sh @@ -1,3 +1,5 @@ #!/bin/sh -clang++ -o msqueue2 -Xclang -load -Xclang /scratch/llvm/build/lib/libCDSPass.so intrusive_msqueue_hp.cc -I. -I /scratch/benchmarks/libcds -g -std=c++11 -L /scratch/random-fuzzer -lmodel -L /scratch/benchmarks/libcds/build-release/bin -lcds_d -lpthread +clang++ -o msqueue2 -Xclang -load -Xclang /scratch/llvm/build/lib/libCDSPass.so intrusive_msqueue_hp.cc -I. -I /scratch/benchmarks/libcds -g -O1 -std=c++11 -L /scratch/new-fuzzer -lmodel -L /scratch/benchmarks/libcds/libcds-llvm/bin -lcds_d -lpthread + +export LD_LIBRARY_PATH=/scratch/benchmarks/libcds/libcds-llvm/bin:/scratch/new-fuzzer/ diff --git a/libcdsTest/ms-queue/tmp b/libcdsTest/ms-queue/tmp deleted file mode 100644 index 1dacb278..00000000 --- a/libcdsTest/ms-queue/tmp +++ /dev/null @@ -1,242 +0,0 @@ -key_delete is called -has write to location: 0x60c1e0 values: 1 -has write to location: 0x1a82928 values: 1a82a10 1a82a20 1a82a30 1a82a40 1a82a50 -has write to location: 0x1a82980 values: 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 -has write to location: 0x1a829e0 values: 7f74888ecf28 0 1a82b10 0 1a82b20 0 1a82b30 0 1a82b40 0 7f74888ecf28 0 1a82b20 0 1a82b20 0 1a82b40 0 1a82b40 0 0 0 -has write to location: 0x1a829f0 values: 1a82b10 0 1a82b10 0 1a82b30 0 1a82b30 0 1a82b50 0 1a82b50 0 -has write to location: 0x1a82b10 values: 0 1a82b20 -has write to location: 0x1a82b20 values: 0 1a82b30 -has write to location: 0x1a82b30 values: 0 1a82b40 -has write to location: 0x1a82b40 values: 0 1a82b50 -has write to location: 0x1a82b50 values: 0 -has write to location: 0x7f74888ecea8 values: 1a82b10 1a82b20 1a82b30 1a82b40 1a82b50 0 -has write to location: 0x7f74888ecee8 values: 1a82b10 1a82b20 1a82b30 1a82b40 1a82b50 0 -has write to location: 0x7f74888ecf28 values: 0 1a82b10 -has write to location: 0x7f74888ecf68 values: 1 2 3 4 5 4 3 2 1 0 -has write to location: 0x7f74888ecf78 values: aaa ccc bbb ------------------------------------------ -location: 0x60c1e0: -0 0 uninitialized relaxed 0x60c1e0 0 ( 0) -location: 0x7f74888ecee8: -0 0 uninitialized relaxed 0x7f74888ecee8 0x7f74888ecf28 ( 0) -location: 0x1a82980: -0 0 uninitialized relaxed 0x1a82980 0 ( 0) -location: 0x7f74888ecee8: -0 0 uninitialized relaxed 0x7f74888ecee8 0x7f74888ecf28 ( 0) -location: 0x7f74888ecf28: -9 1 atomic write release 0x7f74888ecf28 0 ( 0, 9) -location: 0x7f74888ecf28: -9 1 atomic write release 0x7f74888ecf28 0 ( 0, 9) -location: 0x7f74888ecf68: -0 0 uninitialized relaxed 0x7f74888ecf68 0 ( 0) -location: 0x7f74888ecee8: -0 0 uninitialized relaxed 0x7f74888ecee8 0x7f74888ecf28 ( 0) -location: 0x7f74888ecee8: -17 1 atomic rmw release 0x7f74888ecee8 0x7f74888ecf28 0 ( 0, 17) -location: 0x1a82980: -12 1 atomic rmw acq_rel 0x1a82980 0 0 ( 0, 12) -location: 0x7f74888ecee8: -17 1 atomic rmw release 0x7f74888ecee8 0x7f74888ecf28 0 ( 0, 17) -location: 0x1a82b10: -3 1 atomic write release 0x1a82b10 0 ( 0, 3) -location: 0x1a82b10: -3 1 atomic write release 0x1a82b10 0 ( 0, 3) -location: 0x7f74888ecf68: -16 1 atomic rmw relaxed 0x7f74888ecf68 0 0 ( 0, 16) -location: 0x7f74888ecee8: -17 1 atomic rmw release 0x7f74888ecee8 0x7f74888ecf28 0 ( 0, 17) -location: 0x7f74888ecee8: -26 1 atomic rmw release 0x7f74888ecee8 0x1a82b10 17 ( 0, 26) -location: 0x1a82980: -21 1 atomic rmw acq_rel 0x1a82980 0x1 12 ( 0, 21) -location: 0x7f74888ecee8: -26 1 atomic rmw release 0x7f74888ecee8 0x1a82b10 17 ( 0, 26) -location: 0x1a82b20: -4 1 atomic write release 0x1a82b20 0 ( 0, 4) -location: 0x1a82b20: -4 1 atomic write release 0x1a82b20 0 ( 0, 4) -location: 0x7f74888ecf68: -25 1 atomic rmw relaxed 0x7f74888ecf68 0x1 16 ( 0, 25) -location: 0x7f74888ecee8: -26 1 atomic rmw release 0x7f74888ecee8 0x1a82b10 17 ( 0, 26) -location: 0x7f74888ecee8: -35 1 atomic rmw release 0x7f74888ecee8 0x1a82b20 26 ( 0, 35) -location: 0x1a82980: -30 1 atomic rmw acq_rel 0x1a82980 0x2 21 ( 0, 30) -location: 0x7f74888ecee8: -35 1 atomic rmw release 0x7f74888ecee8 0x1a82b20 26 ( 0, 35) -location: 0x1a82b30: -5 1 atomic write release 0x1a82b30 0 ( 0, 5) -location: 0x1a82b30: -5 1 atomic write release 0x1a82b30 0 ( 0, 5) -location: 0x7f74888ecf68: -34 1 atomic rmw relaxed 0x7f74888ecf68 0x2 25 ( 0, 34) -location: 0x7f74888ecee8: -35 1 atomic rmw release 0x7f74888ecee8 0x1a82b20 26 ( 0, 35) -location: 0x7f74888ecee8: -44 1 atomic rmw release 0x7f74888ecee8 0x1a82b30 35 ( 0, 44) -location: 0x1a82980: -39 1 atomic rmw acq_rel 0x1a82980 0x3 30 ( 0, 39) -location: 0x7f74888ecee8: -44 1 atomic rmw release 0x7f74888ecee8 0x1a82b30 35 ( 0, 44) -location: 0x1a82b40: -6 1 atomic write release 0x1a82b40 0 ( 0, 6) -location: 0x1a82b40: -6 1 atomic write release 0x1a82b40 0 ( 0, 6) -location: 0x7f74888ecf68: -43 1 atomic rmw relaxed 0x7f74888ecf68 0x3 34 ( 0, 43) -location: 0x7f74888ecee8: -44 1 atomic rmw release 0x7f74888ecee8 0x1a82b30 35 ( 0, 44) -location: 0x7f74888ecea8: -0 0 uninitialized relaxed 0x7f74888ecea8 0x7f74888ecf28 ( 0) -location: 0x1a82980: -48 1 atomic rmw acq_rel 0x1a82980 0x4 39 ( 0, 48) -location: 0x7f74888ecea8: -0 0 uninitialized relaxed 0x7f74888ecea8 0x7f74888ecf28 ( 0) -location: 0x7f74888ecf28: -15 1 atomic rmw release 0x7f74888ecf28 0 9 ( 0, 15) -location: 0x1a82980: -58 1 atomic rmw acq_rel 0x1a82980 0x5 48 ( 0, 58) -location: 0x7f74888ecf28: -15 1 atomic rmw release 0x7f74888ecf28 0 9 ( 0, 15) -location: 0x7f74888ecea8: -0 0 uninitialized relaxed 0x7f74888ecea8 0x7f74888ecf28 ( 0) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x7f74888ecea8: -0 0 uninitialized relaxed 0x7f74888ecea8 0x7f74888ecf28 ( 0) -location: 0x7f74888ecf68: -52 1 atomic rmw relaxed 0x7f74888ecf68 0x4 43 ( 0, 52) -location: 0x7f74888ecea8: -66 1 atomic rmw acquire 0x7f74888ecea8 0x7f74888ecf28 0 ( 0, 66) -location: 0x1a82980: -62 1 atomic rmw acq_rel 0x1a82980 0x6 58 ( 0, 62) -location: 0x7f74888ecea8: -66 1 atomic rmw acquire 0x7f74888ecea8 0x7f74888ecf28 0 ( 0, 66) -location: 0x1a82b10: -24 1 atomic rmw release 0x1a82b10 0 3 ( 0, 24) -location: 0x1a82980: -72 1 atomic rmw acq_rel 0x1a82980 0x7 62 ( 0, 72) -location: 0x1a82b10: -24 1 atomic rmw release 0x1a82b10 0 3 ( 0, 24) -location: 0x7f74888ecea8: -66 1 atomic rmw acquire 0x7f74888ecea8 0x7f74888ecf28 0 ( 0, 66) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x7f74888ecea8: -66 1 atomic rmw acquire 0x7f74888ecea8 0x7f74888ecf28 0 ( 0, 66) -location: 0x7f74888ecf68: -67 1 atomic rmw relaxed 0x7f74888ecf68 0x5 52 ( 0, 67) -location: 0x1a82928: -0 0 uninitialized relaxed 0x1a82928 0x1a82a00 ( 0) -location: 0x7f74888ecea8: -80 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b10 66 ( 0, 80) -location: 0x1a82980: -76 1 atomic rmw acq_rel 0x1a82980 0x8 72 ( 0, 76) -location: 0x7f74888ecea8: -80 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b10 66 ( 0, 80) -location: 0x1a82b20: -33 1 atomic rmw release 0x1a82b20 0 4 ( 0, 33) -location: 0x1a82980: -88 1 atomic rmw acq_rel 0x1a82980 0x9 76 ( 0, 88) -location: 0x1a82b20: -33 1 atomic rmw release 0x1a82b20 0 4 ( 0, 33) -location: 0x7f74888ecea8: -80 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b10 66 ( 0, 80) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x7f74888ecea8: -80 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b10 66 ( 0, 80) -location: 0x7f74888ecf68: -81 1 atomic rmw relaxed 0x7f74888ecf68 0x4 67 ( 0, 81) -location: 0x1a82928: -83 1 atomic write relaxed 0x1a82928 0x1a82a10 ( 0, 83) -location: 0x7f74888ecea8: -96 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b20 80 ( 0, 96) -location: 0x1a82980: -92 1 atomic rmw acq_rel 0x1a82980 0xa 88 ( 0, 92) -location: 0x7f74888ecea8: -96 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b20 80 ( 0, 96) -location: 0x1a82b30: -42 1 atomic rmw release 0x1a82b30 0 5 ( 0, 42) -location: 0x1a82980: -104 1 atomic rmw acq_rel 0x1a82980 0xb 92 ( 0, 104) -location: 0x1a82b30: -42 1 atomic rmw release 0x1a82b30 0 5 ( 0, 42) -location: 0x7f74888ecea8: -96 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b20 80 ( 0, 96) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x7f74888ecea8: -96 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b20 80 ( 0, 96) -location: 0x7f74888ecf68: -97 1 atomic rmw relaxed 0x7f74888ecf68 0x3 81 ( 0, 97) -location: 0x1a82928: -99 1 atomic write relaxed 0x1a82928 0x1a82a20 ( 0, 99) -location: 0x7f74888ecea8: -112 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b30 96 ( 0, 112) -location: 0x1a82980: -108 1 atomic rmw acq_rel 0x1a82980 0xc 104 ( 0, 108) -location: 0x7f74888ecea8: -112 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b30 96 ( 0, 112) -location: 0x1a82b40: -51 1 atomic rmw release 0x1a82b40 0 6 ( 0, 51) -location: 0x1a82980: -120 1 atomic rmw acq_rel 0x1a82980 0xd 108 ( 0, 120) -location: 0x1a82b40: -51 1 atomic rmw release 0x1a82b40 0 6 ( 0, 51) -location: 0x7f74888ecea8: -112 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b30 96 ( 0, 112) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x7f74888ecea8: -112 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b30 96 ( 0, 112) -location: 0x7f74888ecf68: -113 1 atomic rmw relaxed 0x7f74888ecf68 0x2 97 ( 0, 113) -location: 0x1a82928: -115 1 atomic write relaxed 0x1a82928 0x1a82a30 ( 0, 115) -location: 0x7f74888ecea8: -128 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b40 112 ( 0, 128) -location: 0x1a82980: -124 1 atomic rmw acq_rel 0x1a82980 0xe 120 ( 0, 124) -location: 0x7f74888ecea8: -128 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b40 112 ( 0, 128) -location: 0x1a82b50: -7 1 atomic write release 0x1a82b50 0 ( 0, 7) -location: 0x1a82980: -137 1 atomic rmw acq_rel 0x1a82980 0xf 124 ( 0, 137) -location: 0x1a82b50: -7 1 atomic write release 0x1a82b50 0 ( 0, 7) -location: 0x7f74888ecea8: -128 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b40 112 ( 0, 128) -location: 0x7f74888ecea8: -128 1 atomic rmw acquire 0x7f74888ecea8 0x1a82b40 112 ( 0, 128) -location: 0x7f74888ecee8: -53 1 atomic rmw release 0x7f74888ecee8 0x1a82b40 44 ( 0, 53) -location: 0x1a82928: -131 1 atomic write relaxed 0x1a82928 0x1a82a40 ( 0, 131) -Program output from execution 1: ----- BEGIN PROGRAM OUTPUT ---- -test start -libcds - enqueue node m_pTail loc: 0x7f74888ecee8 -libcds - enqueue node m_pTail loc: 0x7f74888ecee8 -libcds - enqueue node m_pTail loc: 0x7f74888ecee8 -libcds - enqueue node m_pTail loc: 0x7f74888ecee8 -libcds - enqueue node m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -libcds - do_dequeue hode m_pHead loc: 0x7f74888ecea8 -libcds - do_dequeue hode m_pTail loc: 0x7f74888ecee8 -test end ----- END PROGRAM OUTPUT ---- - -ecee8: ecf28, 1a82b10, 1a82b20, 1a82b30, 1a82b40, 1a82b50 -