mpmc-queue: add "-noinit" builds
authorBrian Norris <banorris@uci.edu>
Thu, 8 Nov 2012 18:02:28 +0000 (10:02 -0800)
committerBrian Norris <banorris@uci.edu>
Thu, 8 Nov 2012 18:02:28 +0000 (10:02 -0800)
Build matching test cases where there is no initial element in the
queue.

mpmc-queue/Makefile
mpmc-queue/mpmc-queue.cc

index 520fcf9..472b794 100644 (file)
@@ -2,12 +2,16 @@ include ../benchmarks.mk
 
 TESTNAME = mpmc-queue
 TESTS = mpmc-queue mpmc-1r2w mpmc-2r1w
+TESTS += mpmc-queue-noinit mpmc-1r2w-noinit mpmc-2r1w-noinit
 
 all: $(TESTS)
 
 mpmc-queue: CPPFLAGS += -DCONFIG_MPMC_READERS=2 -DCONFIG_MPMC_WRITERS=2
 mpmc-1r2w: CPPFLAGS += -DCONFIG_MPMC_READERS=1 -DCONFIG_MPMC_WRITERS=2
 mpmc-2r1w: CPPFLAGS += -DCONFIG_MPMC_READERS=2 -DCONFIG_MPMC_WRITERS=1
+mpmc-queue-noinit: CPPFLAGS += -DCONFIG_MPMC_READERS=2 -DCONFIG_MPMC_WRITERS=2 -DCONFIG_MPMC_NO_INITIAL_ELEMENT
+mpmc-1r2w-noinit: CPPFLAGS += -DCONFIG_MPMC_READERS=1 -DCONFIG_MPMC_WRITERS=2 -DCONFIG_MPMC_NO_INITIAL_ELEMENT
+mpmc-2r1w-noinit: CPPFLAGS += -DCONFIG_MPMC_READERS=2 -DCONFIG_MPMC_WRITERS=1 -DCONFIG_MPMC_NO_INITIAL_ELEMENT
 
 $(TESTS): $(TESTNAME).cc $(TESTNAME).h
        $(CXX) -o $@ $< $(CPPFLAGS) $(LDFLAGS)
index 53bc613..baca598 100644 (file)
@@ -91,9 +91,12 @@ int user_main(int argc, char **argv)
        //process_params(argc, argv);
        printf("%d reader(s), %d writer(s)\n", readers, writers);
 
+#ifndef CONFIG_MPMC_NO_INITIAL_ELEMENT
+       printf("Adding initial element\n");
        int32_t *bin = queue.write_prepare();
        store_32(bin, 17);
        queue.write_publish();
+#endif
 
        printf("Start threads\n");