build/regressions: Add CORES option, add "check" target.

The check target will attempt to run the unit tests with some
sane defaults.
ck_pring
Samy Al Bahra 12 years ago
parent fbb88a519c
commit 290add2e50

@ -1,4 +1,4 @@
.PHONY: all clean distribution regressions install install-headers doc uninstall
.PHONY: all check clean distribution doc install install-headers regressions uninstall
CFLAGS=@CFLAGS@
VERSION=@VERSION@
@ -22,6 +22,11 @@ regressions:
$(MAKE) -C regressions all || exit
@echo ---[ Regressions have built successfully.
check: regressions
@echo ---[ Executing unit tests...
$(MAKE) -C regressions check
@echo ---[ Unit tests have completed successfully.
install-headers:
mkdir -p $(DESTDIR)/$(HEADERS) || exit
cp include/*.h $(DESTDIR)/$(HEADERS) || exit

@ -1,6 +1,7 @@
CC=@CC@
MAKE=make
CFLAGS=@CFLAGS@ -I../../../include
CORES=@CORES@
CFLAGS=@CFLAGS@ -I../../../include -DCORES=@CORES@
LD=@LD@
LDFLAGS=@LDFLAGS@
PTHREAD_CFLAGS=@PTHREAD_CFLAGS@

15
configure vendored

@ -85,6 +85,7 @@ generate()
-e "s#@HEADERS@#$HEADERS#g" \
-e "s#@LIBRARY@#$LIBRARY#g" \
-e "s#@PREFIX@#$PREFIX#g" \
-e "s#@CORES@#$CORES#g" \
-e "s#@LD@#$LD#g" \
-e "s#@LDFLAGS@#$LDFLAGS#g" \
-e "s#@PTHREAD_CFLAGS@#$PTHREAD_CFLAGS#g" \
@ -108,6 +109,7 @@ generate_stdout()
echo " LDFLAGS = $LDFLAGS"
echo " GZIP = $GZIP"
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
echo " CORES = $CORES"
echo
echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY"
@ -129,6 +131,9 @@ for option in $*; do
echo " --libdir=N Libraries directory (default is ${PREFIX}/lib)"
echo " --mandir=N Manual pages directory (default is ${PREFIX}/man)"
echo " --prefix=N Installs library files in N (default is $PREFIX)"
echo
echo "The following options will modify code generation."
echo " --cores=N Specify number of cores available on target machine"
echo " --enable-pointer-packing Assumes 48-bit address encoding"
echo
echo "The following environment variables may be used:"
@ -143,6 +148,9 @@ for option in $*; do
--enable-pointer-packing)
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE"
;;
--cores=*)
CORES=$value
;;
--profile=*)
PROFILE=$value
;;
@ -200,6 +208,7 @@ if test "$PROFILE"; then
exit $EXIT_SUCCESS
fi
DCORES=2
printf "Detecting operating system......."
SYSTEM=`uname -s 2> /dev/null`
case "$SYSTEM" in
@ -207,21 +216,26 @@ case "$SYSTEM" in
SYSTEM=solaris
;;
"Linux"|"uClinux")
DCORES=`grep '^processor.*:.*' /proc/cpuinfo|wc -l`
SYSTEM=linux
;;
"FreeBSD"|"GNU/kFreeBSD")
DCORES=`sysctl -n hw.ncpu`
SYSTEM=freebsd
;;
"NetBSD")
DCORES=`sysctl -n hw.ncpu`
SYSTEM=netbsd
;;
"OpenBSD")
SYSTEM=openbsd
;;
"DragonFly")
DCORES=`sysctl -n hw.ncpu`
SYSTEM=dragonflybsd
;;
"Darwin")
DCORES=`sysctl -n hw.ncpu`
SYSTEM=darwin
;;
*)
@ -231,6 +245,7 @@ esac
assert "$SYSTEM" "$SYSTEM" "unsupported"
CORES=${CORES:-${DCORES}}
printf "Detecting machine architecture..."
PLATFORM=`uname -m 2> /dev/null`
case $PLATFORM in

@ -1,4 +1,22 @@
.PHONY: all clean
DIR=backoff \
bag \
barrier \
bitmap \
brlock \
bytelock \
epoch \
fifo \
hp \
ht \
pr \
queue \
ring \
rwlock \
sequence \
spinlock \
stack
.PHONY: all clean check
all:
$(MAKE) -C ./ck_bitmap/validate all
@ -60,3 +78,12 @@ clean:
$(MAKE) -C ./ck_hp/benchmark clean
$(MAKE) -C ./ck_bag/validate clean
check: all
rc=0; \
for d in $(DIR) ; do \
echo "----[ Testing $$d...."; \
$(MAKE) -C ./ck_$$d/validate check || rc=1; \
echo; \
done; \
exit $$rc

@ -1,10 +1,13 @@
.PHONY: clean
.PHONY: check clean
all: validate
validate: validate.c ../../../include/ck_backoff.h
$(CC) $(CFLAGS) -o validate validate.c
check: all
./validate
clean:
rm -rf validate *.dSYM

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=order
@ -7,6 +7,9 @@ all: $(OBJECTS)
order: order.c ../../../include/ck_bag.h ../../../src/ck_bag.c ../../../src/ck_epoch.c
$(CC) $(CFLAGS) -o order order.c ../../../src/ck_bag.c ../../../src/ck_epoch.c
check: all
./order
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)

@ -35,7 +35,7 @@
#include "../../common.h"
#define NUM_READER_THREADS 8
#define NUM_READER_THREADS 2
#define READ_LATENCY 8
static ck_bag_t bag;
@ -43,7 +43,7 @@ static ck_epoch_t epoch_bag;
static ck_epoch_record_t epoch_wr;
static int leave;
static unsigned int barrier;
static unsigned int writer_max = 131072;
static unsigned int writer_max = 32768;
struct bag_epoch {
ck_epoch_entry_t epoch_entry;
@ -291,7 +291,7 @@ main(int argc, char **argv)
pthread_create(&readers[i], NULL, reader, NULL);
}
sleep(120);
sleep(30);
ck_pr_store_int(&leave, 1);
for (i = 0; i < NUM_READER_THREADS; i++)

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=barrier_centralized barrier_combining barrier_dissemination barrier_tournament barrier_mcs
@ -19,6 +19,14 @@ barrier_tournament: barrier_tournament.c ../../../include/ck_barrier.h ../../../
barrier_mcs: barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c
$(CC) $(CFLAGS) -o barrier_mcs barrier_mcs.c ../../../src/ck_barrier_mcs.c
check: all
rc=0; \
for d in $(OBJECTS) ; do \
echo $$d; \
./$$d $(CORES) 1 1 || rc=1; \
done; \
exit $$rc
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)

@ -87,7 +87,7 @@ main(int argc, char *argv[])
pthread_t *threads;
int i;
if (argc != 3) {
if (argc < 3) {
fprintf(stderr, "Usage: correct <number of threads> <affinity delta>\n");
exit(EXIT_FAILURE);
}

@ -98,7 +98,7 @@ main(int argc, char *argv[])
}
ck_barrier_combining_init(&barrier, init_root);
if (argc != 4) {
if (argc < 4) {
fprintf(stderr, "Usage: correct <total groups> <threads per group> <affinity delta>\n");
exit(EXIT_FAILURE);
}

@ -91,7 +91,7 @@ main(int argc, char *argv[])
pthread_t *threads;
int i, size;
if (argc != 3) {
if (argc < 3) {
fprintf(stderr, "Usage: correct <number of threads> <affinity delta>\n");
exit(EXIT_FAILURE);
}

@ -91,7 +91,7 @@ main(int argc, char *argv[])
ck_barrier_mcs_t *barrier;
int i;
if (argc != 3) {
if (argc < 3) {
fprintf(stderr, "Usage: correct <number of threads> <affinity delta>\n");
exit(EXIT_FAILURE);
}

@ -95,7 +95,7 @@ main(int argc, char *argv[])
int i;
unsigned int size;
if (argc != 3) {
if (argc < 3) {
fprintf(stderr, "Usage: correct <number of threads> <affinity delta>\n");
exit(EXIT_FAILURE);
}

@ -1,4 +1,4 @@
.PHONY: clean
.PHONY: check clean
OBJECTS=serial
@ -10,5 +10,8 @@ serial: serial.c ../../../include/ck_bitmap.h
clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM
check: all
./serial
include ../../../build/regressions.build
CFLAGS+=-D_GNU_SOURCE

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=validate
@ -7,6 +7,9 @@ all: $(OBJECTS)
validate: validate.c ../../../include/ck_brlock.h
$(CC) $(CFLAGS) -o validate validate.c
check: all
./validate $(CORES) 1
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=validate
@ -7,6 +7,9 @@ all: $(OBJECTS)
validate: validate.c
$(CC) $(CFLAGS) -o validate validate.c
check: all
./validate $(CORES) 1
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)

@ -1,9 +1,13 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_stack ck_stack_read
all: $(OBJECTS)
check: all
./ck_stack $(CORES) 10 1
./ck_stack_read $(CORES) 10 1
ck_stack_read: ck_stack_read.c ../../../include/ck_stack.h ../../../include/ck_epoch.h ../../../src/ck_epoch.c
$(CC) $(CFLAGS) -o ck_stack_read ck_stack_read.c ../../../src/ck_epoch.c

@ -1,8 +1,14 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_fifo_spsc ck_fifo_mpmc ck_fifo_spsc_iterator ck_fifo_mpmc_iterator
all: ck_fifo_spsc ck_fifo_mpmc ck_fifo_spsc_iterator ck_fifo_mpmc_iterator
all: $(OBJECTS)
check: all
./ck_fifo_spsc $(CORES) 1 64000
./ck_fifo_mpmc $(CORES) 1 64000
./ck_fifo_spsc_iterator
./ck_fifo_mpmc_iterator
ck_fifo_spsc: ck_fifo_spsc.c
$(CC) $(CFLAGS) -o ck_fifo_spsc ck_fifo_spsc.c

@ -1,9 +1,15 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_hp_stack nbds_haz_test serial ck_hp_fifo
all: $(OBJECTS)
check: all
./serial
./ck_hp_stack $(CORES) 10 1
./ck_hp_fifo $(CORES) 1 64000 10
./nbds_haz_test $(CORES) 10 1
ck_hp_stack: ../../../src/ck_hp.c ck_hp_stack.c ../../../include/ck_hp_stack.h
$(CC) $(CFLAGS) ../../../src/ck_hp.c -o ck_hp_stack ck_hp_stack.c

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=serial
@ -7,6 +7,9 @@ all: $(OBJECTS)
serial: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c
$(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_ht.c
check: all
./serial
clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_pr_cas ck_pr_faa ck_pr_inc ck_pr_dec ck_pr_bts \
ck_pr_btr ck_pr_btc ck_pr_load ck_pr_store \
@ -8,6 +8,13 @@ OBJECTS=ck_pr_cas ck_pr_faa ck_pr_inc ck_pr_dec ck_pr_bts \
all: $(OBJECTS)
check: all
rc=0; \
for d in $(OBJECTS) ; do \
echo $$d; \
./$$d || exit 1; \
done;
ck_pr_cas: ck_pr_cas.c
$(CC) $(CFLAGS) -o ck_pr_cas ck_pr_cas.c

@ -1,10 +1,14 @@
.PHONY: clean distribution
.PHONY: check clean distribution
HEADER=../../../include/ck_queue.h
OBJECTS=ck_slist ck_list
all: $(OBJECTS)
check: all
./ck_slist $(CORES) 100000
./ck_list $(CORES) 100000
ck_slist: $(HEADER) ck_slist.c
$(CC) $(CFLAGS) -o ck_slist ck_slist.c

@ -1,9 +1,13 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_ring_spsc ck_ring_spsc_template
all: $(OBJECTS)
check: all
./ck_ring_spsc $(CORES) 1 65536
./ck_ring_spsc_template $(CORES) 1 65536
ck_ring_spsc_template: ck_ring_spsc_template.c ../../../include/ck_ring.h
$(CC) $(CFLAGS) -o ck_ring_spsc_template ck_ring_spsc_template.c

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=validate
@ -7,6 +7,9 @@ all: $(OBJECTS)
validate: validate.c ../../../include/ck_rwlock.h
$(CC) $(CFLAGS) -o validate validate.c
check: all
./validate $(CORES) 1
clean:
rm -rf *.dSYM *~ *.o $(OBJECTS)

@ -1,5 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=ck_sequence
@ -8,6 +7,9 @@ all: $(OBJECTS)
ck_sequence: ck_sequence.c ../../../include/ck_sequence.h
$(CC) $(CFLAGS) -o ck_sequence ck_sequence.c
check: all
./ck_sequence $(CORES) 1
clean:
rm -rf *~ *.o $(OBJECTS) *.dSYM

@ -1,8 +1,20 @@
.PHONY: clean
.PHONY: check clean
all: ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock \
ck_ticket_pb ck_anderson ck_spinlock
check: all
./ck_ticket $(CORES) 1
./ck_mcs $(CORES) 1
./ck_dec $(CORES) 1
./ck_cas $(CORES) 1
./ck_fas $(CORES) 1
./ck_clh $(CORES) 1
./linux_spinlock $(CORES) 1
./ck_ticket_pb $(CORES) 1
./ck_anderson $(CORES) 1
./ck_spinlock $(CORES) 1
linux_spinlock: linux_spinlock.c
$(CC) $(CFLAGS) -o linux_spinlock linux_spinlock.c

@ -1,4 +1,4 @@
.PHONY: clean distribution
.PHONY: check clean distribution
OBJECTS=serial mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push \
mpmc_pop upmc_pop spinlock_pop spinlock_eb_pop \
@ -7,6 +7,18 @@ OBJECTS=serial mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push \
all: $(OBJECTS)
check: all
./serial
./mpmc_pair $(CORES) 1 0
./upmc_trypop $(CORES) 1 0
./mpmc_trypop $(CORES) 1 0
./mpmc_trypair $(CORES) 1 0
./mpmc_pop $(CORES) 1 0
./upmc_pop $(CORES) 1 0
./mpnc_push $(CORES) 1 0
./mpmc_push $(CORES) 1 0
./upmc_push $(CORES) 1 0
serial: serial.c
$(CC) $(CFLAGS) -o serial serial.c

Loading…
Cancel
Save