[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] make check infrastructure



Signed-off-by: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>

----- Forwarded message from Rusty Russell <rusty@xxxxxxxxxxxxxxx> -----

To: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>
From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: [PATCH 1/3] make check infrastructure
Date: Fri, 09 Dec 2005 16:44:15 +1100

This patch adds a top level "make check" and "make fullcheck" on which
we can implement unit tests.

"make -s check" is designed to take much less time than a xen compile,
so no excuse for not running it.

"make fullcheck" requires valgrind, and takes longer than make -s check,
but is designed for more thorough tests.

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

diff -urN --exclude=.hg --exclude='*~' --exclude='*.aux' 
xen-unstable.hg-mainline/Makefile xen-unstable.hg-check/Makefile
--- xen-unstable.hg-mainline/Makefile   2005-11-21 12:54:52.000000000 +1100
+++ xen-unstable.hg-check/Makefile      2005-12-09 16:33:19.000000000 +1100
@@ -41,6 +41,10 @@
 test:
        $(MAKE) -C tools/python test
 
+# Code checking
+check fullcheck:
+       $(MAKE) -C xen $@
+
 # build and install everything into local dist directory
 dist: DESTDIR=$(DISTDIR)/install
 dist: dist-xen dist-kernels dist-tools dist-docs
diff -urN --exclude=.hg --exclude='*~' --exclude='*.aux' 
xen-unstable.hg-mainline/xen/Makefile xen-unstable.hg-check/xen/Makefile
--- xen-unstable.hg-mainline/xen/Makefile       2005-12-09 16:16:47.000000000 
+1100
+++ xen-unstable.hg-check/xen/Makefile  2005-12-09 16:33:19.000000000 +1100
@@ -25,6 +25,11 @@
 
 build: $(TARGET).gz
 
+# Code Check
+check fullcheck:
+       $(MAKE) -C test $@
+       $(MAKE) -C common $@
+
 install: $(TARGET).gz
        [ -d $(DESTDIR)/boot ] || $(INSTALL_DIR) $(DESTDIR)/boot
        $(INSTALL_DATA) $(TARGET).gz $(DESTDIR)/boot/$(notdir 
$(TARGET))-$(XEN_FULLVERSION).gz
@@ -40,6 +45,7 @@
 
 clean: delete-unfresh-files
        $(MAKE) -C tools clean
+       $(MAKE) -C test clean
        $(MAKE) -C common clean
        $(MAKE) -C drivers clean
        $(MAKE) -C acm clean
diff -urN --exclude=.hg --exclude='*~' --exclude='*.aux' 
xen-unstable.hg-mainline/xen/common/Makefile 
xen-unstable.hg-check/xen/common/Makefile
--- xen-unstable.hg-mainline/xen/common/Makefile        2005-11-25 
16:49:03.000000000 +1100
+++ xen-unstable.hg-check/xen/common/Makefile   2005-12-09 16:33:19.000000000 
+1100
@@ -9,8 +9,13 @@
 common.o: $(OBJS)
        $(LD) $(LDFLAGS) -r -o common.o $(OBJS)
 
+# Run the code checks
+check fullcheck:
+       $(MAKE) -C test $@
+
 clean:
        rm -f *.o *~ core
+       $(MAKE) -C test clean
 
 # Object file contains changeset and compiler information.
 kernel.o: $(BASEDIR)/include/xen/compile.h
diff -urN --exclude=.hg --exclude='*~' --exclude='*.aux' 
xen-unstable.hg-mainline/xen/common/test/Makefile 
xen-unstable.hg-check/xen/common/test/Makefile
--- xen-unstable.hg-mainline/xen/common/test/Makefile   1970-01-01 
10:00:00.000000000 +1000
+++ xen-unstable.hg-check/xen/common/test/Makefile      2005-12-09 
16:33:19.000000000 +1100
@@ -0,0 +1,26 @@
+TEST_C_FILES=$(wildcard *.c)
+TESTS=$(TEST_C_FILES:.c=)
+COV_FLAGS=
+
+include ../../../Config.mk
+
+.PHONY: check
+check: $(TESTS)
+       @echo -n `pwd`:
+       @for f in $(TESTS); do if $(VALGRIND) ./$$f; then echo -n .; else echo 
$$f failed.; exit 1; fi; done
+       @echo
+
+fullcheck:
+       $(MAKE) VALGRIND="valgrind -q" check
+clean:
+       -rm -f $(TESTS) .*.d *gc*
+
+$(TESTS): ../../test/fake.o
+
+$(TESTS): %: %.c
+       $(HOSTCC) -g -Wall -Werror -Wstrict-prototypes -Wmissing-declarations 
-I../../test -MD -MF $(@D)/.$(@F).d $(COV_FLAGS) -o $@ $< ../../test/fake.o
+
+coverage: clean 
+       $(MAKE) COV_FLAGS=-fprofile-arcs check
+
+-include .*.d
diff -urN --exclude=.hg --exclude='*~' --exclude='*.aux' 
xen-unstable.hg-mainline/xen/test/Makefile 
xen-unstable.hg-check/xen/test/Makefile
--- xen-unstable.hg-mainline/xen/test/Makefile  1970-01-01 10:00:00.000000000 
+1000
+++ xen-unstable.hg-check/xen/test/Makefile     2005-12-09 16:33:19.000000000 
+1100
@@ -0,0 +1,13 @@
+LINKS:=asm/types.h asm/uaccess.h asm/system.h asm/desc.h xen/config.h 
xen/types.h xen/errno.h xen/bitmap.h xen/bitops.h xen/lib.h xen/spinlock.h 
xen/time.h xen/string.h xen/init.h xen/sched.h xen/smp.h xen/perfc.h 
xen/softirq.h xen/ac_timer.h xen/keyhandler.h xen/mm.h public/acm.h 
public/acm_ops.h xen/event.h xen/trace.h xen/console.h asm/shadow.h 
public/sched_ctl.h acm/acm_hooks.h xen/domain.h xen/domain_page.h 
asm/debugger.h public/dom0_ops.h public/sched.h public/vcpu.h xen/irq.h 
asm/current.h public/xen.h public/event_chnnel.h
+
+
+clean:
+       rm -f $(LINKS) fake.o
+
+check fullcheck: $(LINKS) fake.o
+
+fake.o: CFLAGS=-Wall -g -I .
+
+$(LINKS):
+       mkdir -p $(dir $@)
+       ln -s `pwd`/fake-include.h $@

-- 
 ccontrol: http://freshmeat.net/projects/ccontrol

----- End forwarded message -----

Yours Tony

   linux.conf.au       http://linux.conf.au/ || http://lca2006.linux.org.au/
   Jan 23-28 2006      The Australian Linux Technical Conference!


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.