ia64/xen-unstable

changeset 7891:ab845d97de72

Add hping to the ramdisk. Also, do some very simple versioning.
This is the first change to the ramdisk since v0.1.0. So, we now build
the image as initrd-X.Y.img, and link initrd.img to it. This lets us
have a few checks to make sure that people rebuild their ramdisks when
necessary.
author dan@localhost.localdomain
date Fri Nov 18 13:00:13 2005 +0100 (2005-11-18)
parents 60bb9e11bd7d
children d02fd103cbc6
files tools/xm-test/Makefile.am tools/xm-test/README tools/xm-test/configure.ac tools/xm-test/lib/XmTestReport/xmtest.py.in tools/xm-test/ramdisk/Makefile.am tools/xm-test/ramdisk/configs/buildroot tools/xm-test/ramdisk/patches/buildroot/hping.patch tools/xm-test/runtest.sh
line diff
     1.1 --- a/tools/xm-test/Makefile.am	Fri Nov 18 12:58:38 2005 +0100
     1.2 +++ b/tools/xm-test/Makefile.am	Fri Nov 18 13:00:13 2005 +0100
     1.3 @@ -1,6 +1,9 @@
     1.4  SUBDIRS = ramdisk tests
     1.5  EXTRA_DIST = lib runtest.sh mkreport
     1.6  
     1.7 +existing:
     1.8 +	$(MAKE) -C ramdisk existing
     1.9 +
    1.10  # Remove any pyc's, CVS dirs, and prune the skel dirs
    1.11  dist-hook:
    1.12  	find $(distdir) -name '*~' -delete -print
     2.1 --- a/tools/xm-test/README	Fri Nov 18 12:58:38 2005 +0100
     2.2 +++ b/tools/xm-test/README	Fri Nov 18 13:00:13 2005 +0100
     2.3 @@ -45,11 +45,15 @@ special files, this process must be done
     2.4  NB: If you have the initrd.img from another installation of xm-test,
     2.5  you can copy it into the ramdisk directory to eliminate the need to
     2.6  rebuild it.  If you do this, there is no need to run 'make' again.
     2.7 -Simply copy the initrd.img file into ramdisk/ and then run the
     2.8 -runtest.sh script.  Note that in general, you should not attempt to
     2.9 -use a ramdisk from a previous minor version of xm-test (i.e., don't
    2.10 -use a ramdisk from 0.4.0 with 0.5.0.  0.5.0 should work for 0.5.3
    2.11 -though)
    2.12 +Simply copy the initrd-X.Y.img file into ramdisk/ and then run:
    2.13 +
    2.14 +   # make existing
    2.15 +
    2.16 +This will set up the link so that xm-test will use the existing
    2.17 +ramdisk.  Next, just run "runtest.sh" normally.  Note that in general,
    2.18 +you should not attempt to use a ramdisk from a previous minor version
    2.19 +of xm-test (i.e., don't use a ramdisk from 0.4.0 with 0.5.0.  0.5.0
    2.20 +should work for 0.5.3 though)
    2.21  
    2.22  
    2.23  Running
     3.1 --- a/tools/xm-test/configure.ac	Fri Nov 18 12:58:38 2005 +0100
     3.2 +++ b/tools/xm-test/configure.ac	Fri Nov 18 13:00:13 2005 +0100
     3.3 @@ -1,7 +1,7 @@
     3.4  # xm-test configure.ac input script
     3.5  
     3.6  # Basic header information
     3.7 -AC_INIT([xm-test], [0.5.0])
     3.8 +AC_INIT([xm-test], [0.6.0])
     3.9  AM_INIT_AUTOMAKE([1.7 foreign])
    3.10  
    3.11  # Check for dependencies
    3.12 @@ -65,5 +65,6 @@ AC_CONFIG_FILES([
    3.13      lib/XmTestLib/config.py
    3.14      ])
    3.15  
    3.16 +AC_OUTPUT
    3.17  
    3.18 -AC_OUTPUT
    3.19 +chmod a+x lib/XmTestReport/xmtest.py
     4.1 --- a/tools/xm-test/lib/XmTestReport/xmtest.py.in	Fri Nov 18 12:58:38 2005 +0100
     4.2 +++ b/tools/xm-test/lib/XmTestReport/xmtest.py.in	Fri Nov 18 13:00:13 2005 +0100
     4.3 @@ -1,3 +1,15 @@
     4.4  #!/usr/bin/python
     4.5  
     4.6  XM_TEST_VERSION = "@PACKAGE_VERSION@"
     4.7 +
     4.8 +if __name__ == "__main__":
     4.9 +    import re
    4.10 +
    4.11 +    match = re.match("^(\d+)\.(\d+)\.(\d+)$", XM_TEST_VERSION)
    4.12 +
    4.13 +    print "XM_TEST_VERSION=%s" % XM_TEST_VERSION
    4.14 +    if match:
    4.15 +        print "XM_TEST_MAJ=%s" % match.group(1)
    4.16 +        print "XM_TEST_MIN=%s" % match.group(2)
    4.17 +        print "XM_TEST_REV=%s" % match.group(3)
    4.18 +        
     5.1 --- a/tools/xm-test/ramdisk/Makefile.am	Fri Nov 18 12:58:38 2005 +0100
     5.2 +++ b/tools/xm-test/ramdisk/Makefile.am	Fri Nov 18 13:00:13 2005 +0100
     5.3 @@ -1,5 +1,5 @@
     5.4  
     5.5 -EXTRA_DIST = skel configs
     5.6 +EXTRA_DIST = skel configs patches
     5.7  
     5.8  BR_TAR = buildroot-20050823.tar.bz2
     5.9  BR_URL = http://buildroot.uclibc.org/downloads/snapshots/$(BR_TAR)
    5.10 @@ -9,6 +9,9 @@ BR_IMG = $(BR_SRC)/rootfs.i386.ext2
    5.11  
    5.12  BR_ROOT = build_i386/root
    5.13  
    5.14 +XMTEST_MAJ_VER = $(shell echo @PACKAGE_VERSION@ | perl -pe 's/(\d+)\.(\d+)\.\d+/\1.\2/')
    5.15 +XMTEST_VER_IMG = initrd-$(XMTEST_MAJ_VER).img
    5.16 +
    5.17  all: initrd.img
    5.18  
    5.19  $(BR_TAR):
    5.20 @@ -21,12 +24,21 @@ all: initrd.img
    5.21  	cp configs/buildroot $(BR_SRC)/.config
    5.22  	cp configs/busybox $(BR_SRC)/package/busybox/busybox.config
    5.23  	cp configs/uClibc $(BR_SRC)/toolchain/uClibc/uClibc.config
    5.24 +	(for i in patches/buildroot/*.patch; do \
    5.25 +	  cd $(BR_SRC) && patch -p1 <../$$i; done )
    5.26  	cd $(BR_SRC) && make oldconfig && make
    5.27  
    5.28 -initrd.img: $(BR_IMG)
    5.29 +$(XMTEST_VER_IMG): $(BR_IMG)
    5.30  	(cd skel; tar cf - .) | (cd $(BR_SRC)/$(BR_ROOT); tar xvf -)
    5.31  	cd $(BR_SRC) && make
    5.32 -	cp $(BR_IMG) initrd.img
    5.33 +	cp $(BR_IMG) initrd-$(XMTEST_MAJ_VER).img
    5.34 +
    5.35 +initrd.img: $(XMTEST_VER_IMG)
    5.36 +	ln -sf $(XMTEST_VER_IMG) initrd.img
    5.37 +
    5.38 +existing:
    5.39 +	@[ -f $(XMTEST_VER_IMG) ] && ln -sf $(XMTEST_VER_IMG) initrd.img || \
    5.40 +	echo Error, $(XMTEST_VER_IMG) not found
    5.41  
    5.42  clean-local: am_config_clean-local
    5.43  
     6.1 --- a/tools/xm-test/ramdisk/configs/buildroot	Fri Nov 18 12:58:38 2005 +0100
     6.2 +++ b/tools/xm-test/ramdisk/configs/buildroot	Fri Nov 18 13:00:13 2005 +0100
     6.3 @@ -225,6 +225,7 @@ BR2_PACKAGE_BUSYBOX_CONFIG="package/busy
     6.4  # BR2_PACKAGE_WIRELESS_TOOLS is not set
     6.5  # BR2_PACKAGE_XORG is not set
     6.6  # BR2_PACKAGE_ZLIB is not set
     6.7 +BR2_PACKAGE_HPING=y
     6.8  
     6.9  #
    6.10  # Target Options
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/xm-test/ramdisk/patches/buildroot/hping.patch	Fri Nov 18 13:00:13 2005 +0100
     7.3 @@ -0,0 +1,67 @@
     7.4 +diff -Naur buildroot.orig/package/Config.in buildroot/package/Config.in
     7.5 +--- buildroot.orig/package/Config.in	2005-11-15 07:30:21.000000000 -0800
     7.6 ++++ buildroot/package/Config.in	2005-11-15 07:30:54.000000000 -0800
     7.7 +@@ -118,6 +118,6 @@
     7.8 + source "package/wireless-tools/Config.in"
     7.9 + source "package/xorg/Config.in"
    7.10 + source "package/zlib/Config.in"
    7.11 +-
    7.12 ++source "package/hping/Config.in"
    7.13 + 
    7.14 + endmenu
    7.15 +diff -Naur buildroot.orig/package/hping/Config.in buildroot/package/hping/Config.in
    7.16 +--- buildroot.orig/package/hping/Config.in	1969-12-31 16:00:00.000000000 -0800
    7.17 ++++ buildroot/package/hping/Config.in	2005-11-14 14:13:20.000000000 -0800
    7.18 +@@ -0,0 +1,5 @@
    7.19 ++config BR2_PACKAGE_HPING
    7.20 ++	bool "hping"
    7.21 ++	default y
    7.22 ++	help
    7.23 ++		This is the hping package
    7.24 +diff -Naur buildroot.orig/package/hping/hping.mk buildroot/package/hping/hping.mk
    7.25 +--- buildroot.orig/package/hping/hping.mk	1969-12-31 16:00:00.000000000 -0800
    7.26 ++++ buildroot/package/hping/hping.mk	2005-11-14 15:11:06.000000000 -0800
    7.27 +@@ -0,0 +1,43 @@
    7.28 ++# Taken from the buildroot examples
    7.29 ++
    7.30 ++HPING_VERSION = 2.0.0-rc3
    7.31 ++HPING_TBALL = hping$(HPING_VERSION).tar.gz
    7.32 ++HPING_URL = http://www.hping.org/$(HPING_TBALL)
    7.33 ++HPING_DIR = $(BUILD_DIR)/hping2-rc3
    7.34 ++HPING_TARGET_BINARY = usr/bin/hping
    7.35 ++HPING_BINARY = hping
    7.36 ++
    7.37 ++$(DL_DIR)/$(HPING_TBALL):
    7.38 ++	$(WGET) -P $(DL_DIR) $(HPING_URL)
    7.39 ++
    7.40 ++$(HPING_DIR)/.source: $(DL_DIR)/$(HPING_TBALL)
    7.41 ++	tar xzf $(DL_DIR)/$(HPING_TBALL) -C $(BUILD_DIR)
    7.42 ++	touch $(HPING_DIR)/.source
    7.43 ++
    7.44 ++$(HPING_DIR)/.configured: $(HPING_DIR)/.source
    7.45 ++	(cd $(HPING_DIR); \
    7.46 ++	./configure; )
    7.47 ++	cat $(HPING_DIR)/Makefile | grep -v './hping2 -v' > $(HPING_DIR)/foo
    7.48 ++	mv $(HPING_DIR)/foo $(HPING_DIR)/Makefile
    7.49 ++	touch $(HPING_DIR)/.configured 
    7.50 ++
    7.51 ++$(HPING_DIR)/$(HPING_BINARY): $(HPING_DIR)/.configured
    7.52 ++	$(MAKE) CC=$(TARGET_CC) -C $(HPING_DIR)
    7.53 ++
    7.54 ++$(TARGET_DIR)/$(HPING_TARGET_BINARY): $(HPING_DIR)/$(HPING_BINARY)
    7.55 ++	cp $(HPING_DIR)/hping2 $(TARGET_DIR)/bin
    7.56 ++
    7.57 ++hping: $(TARGET_DIR)/$(HPING_TARGET_BINARY)
    7.58 ++
    7.59 ++hping-clean:
    7.60 ++	$(MAKE) prefix=$(TARGET_DIR)/usr -C $(HPING_DIR) uninstall
    7.61 ++	-$(MAKE) -C $(HPING_DIR) clean
    7.62 ++
    7.63 ++hping-dirclean:
    7.64 ++	rm -Rf $(HPING_DIR)
    7.65 ++
    7.66 ++ifeq ($(strip $(BR2_PACKAGE_HPING)),y)
    7.67 ++TARGETS += hping
    7.68 ++endif
    7.69 ++
    7.70 ++
     8.1 --- a/tools/xm-test/runtest.sh	Fri Nov 18 12:58:38 2005 +0100
     8.2 +++ b/tools/xm-test/runtest.sh	Fri Nov 18 13:00:13 2005 +0100
     8.3 @@ -61,19 +61,31 @@ runnable_tests() {
     8.4      fi
     8.5  
     8.6      # See if the ramdisk has been built
     8.7 -    rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
     8.8 +    rdsize=$(stat -Lc %s ramdisk/initrd.img 2>/dev/null)
     8.9      if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
    8.10  	echo "Cannot find a valid ramdisk.  You need to run \"make\" or"
    8.11  	echo "copy in a previously-built ramdisk to the ramdisk/ directory"
    8.12  	exit 1
    8.13      fi
    8.14  
    8.15 +    # Figure out the version of the ramdisk link and compare it
    8.16 +    # to what it should be as a cheap way of making sure we're
    8.17 +    # using the right version
    8.18 +    realrd=$(readlink ramdisk/initrd.img)
    8.19 +    eval $(./lib/XmTestReport/xmtest.py)
    8.20 +    rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}.img"
    8.21 +    if [ "$realrd" != "$rrdver" ]; then
    8.22 +	echo "Error: ramdisk/initrd.img is from an old version"
    8.23 +	echo "You need to build a ramdisk from at least ${XM_TEST_MAJ}.${XM_TEST_MIN}"
    8.24 +	exit 1
    8.25 +    fi
    8.26 +
    8.27      # See if xend is running
    8.28      if ! xm list >/dev/null 2>&1; then
    8.29  	echo "'xm list' failed: is xend running?"
    8.30  	exit 1
    8.31      fi
    8.32 -    
    8.33 +
    8.34  }
    8.35  
    8.36  # Get contact info if needed