From f769f842a416ed141b4b14c62a797b22a04c4cb7 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 21 Dec 2013 18:25:40 -0500 Subject: [PATCH] regressions: Additional coverage for delete mode. --- regressions/ck_hs/benchmark/Makefile | 5 ++++- regressions/ck_hs/benchmark/parallel_bytestring.c | 7 ++++++- regressions/ck_hs/validate/serial.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/regressions/ck_hs/benchmark/Makefile b/regressions/ck_hs/benchmark/Makefile index 18ccdba..ca20809 100644 --- a/regressions/ck_hs/benchmark/Makefile +++ b/regressions/ck_hs/benchmark/Makefile @@ -1,6 +1,6 @@ .PHONY: clean distribution -OBJECTS=serial parallel_bytestring +OBJECTS=serial parallel_bytestring parallel_bytestring.delete all: $(OBJECTS) @@ -10,6 +10,9 @@ serial: serial.c ../../../include/ck_hs.h ../../../src/ck_hs.c parallel_bytestring: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c +parallel_bytestring.delete: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c + $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -DHS_DELETE -o parallel_bytestring.delete parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c + clean: rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe diff --git a/regressions/ck_hs/benchmark/parallel_bytestring.c b/regressions/ck_hs/benchmark/parallel_bytestring.c index f961837..ea2eaec 100644 --- a/regressions/ck_hs/benchmark/parallel_bytestring.c +++ b/regressions/ck_hs/benchmark/parallel_bytestring.c @@ -140,11 +140,16 @@ static struct ck_malloc my_allocator = { static void set_init(void) { + unsigned int mode = CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC; + +#ifdef HS_DELETE + mode |= CK_HS_MODE_DELETE; +#endif ck_epoch_init(&epoch_hs); ck_epoch_register(&epoch_hs, &epoch_wr); common_srand48((long int)time(NULL)); - if (ck_hs_init(&hs, CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC, hs_hash, hs_compare, &my_allocator, 65536, common_lrand48()) == false) { + if (ck_hs_init(&hs, mode, hs_hash, hs_compare, &my_allocator, 65536, common_lrand48()) == false) { perror("ck_hs_init"); exit(EXIT_FAILURE); } diff --git a/regressions/ck_hs/validate/serial.c b/regressions/ck_hs/validate/serial.c index 5e0c1c3..97461d6 100644 --- a/regressions/ck_hs/validate/serial.c +++ b/regressions/ck_hs/validate/serial.c @@ -117,7 +117,7 @@ run_test(unsigned int is, unsigned int ad) h = test[i][0]; ck_hs_put(&hs[j], h, test[i]); if (ck_hs_put(&hs[j], h, test[i]) == true) { - ck_error("ERROR [%u] [1]: put must fail on collision.\n", is); + ck_error("ERROR [%u] [1]: put must fail on collision (%s).\n", is, test[i]); } if (ck_hs_get(&hs[j], h, test[i]) == NULL) { ck_error("ERROR [%u]: get must not fail after put\n", is);