]> git.ozlabs.org Git - petitboot/commitdiff
Parser test cleanup
authorGeoff Levand <geoff@infradead.org>
Mon, 19 Mar 2012 05:19:49 +0000 (22:19 -0700)
committerGeoff Levand <geoff@infradead.org>
Mon, 19 Mar 2012 05:19:49 +0000 (22:19 -0700)
Major cleanup of parser tests.

 * Change test data directory layout to ease test automation.
 * Remove some unneeded files.
 * Re-write test wraper script, rename to run-parser-tests.
 * Rework for autotools.

Signed-off-by: Geoff Levand <geoff@infradead.org>
48 files changed:
configure.ac.in
test/Makefile.am
test/parser-test.c [deleted file]
test/parser-test.sh [deleted file]
test/parser/001/expected-output [deleted file]
test/parser/001/ps3da1/etc/kboot.conf [deleted file]
test/parser/002/expected-output [deleted file]
test/parser/002/ps3da1/etc/yaboot.conf [deleted file]
test/parser/003/expected-output [deleted file]
test/parser/003/ps3da1/etc/kboot.conf [deleted file]
test/parser/004/expected-output [deleted file]
test/parser/004/rootdev [deleted file]
test/parser/004/sda1/etc/kboot.conf [deleted file]
test/parser/005/expected-output [deleted file]
test/parser/005/ps3da1/etc/kboot.conf [deleted file]
test/parser/101/expected-output [deleted file]
test/parser/101/ps3da1/etc/kboot.conf [deleted file]
test/parser/102/expected-output [deleted file]
test/parser/102/ps3da1/etc/kboot.conf [deleted file]
test/parser/103/ps3da1/etc/kboot.conf [deleted file]
test/parser/201/ps3da1/etc/yaboot.conf [deleted file]
test/parser/202/ps3da1/etc/yaboot.conf [deleted file]
test/parser/203/ps3da1/etc/yaboot.conf [deleted file]
test/parser/204/ps3da1/etc/yaboot.conf [deleted file]
test/parser/205/ps3da1/etc/yaboot.conf [deleted file]
test/parser/Makefile.am [new file with mode: 0644]
test/parser/data/kboot-01/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-01/expected-output [new file with mode: 0644]
test/parser/data/kboot-02/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-02/expected-output [new file with mode: 0644]
test/parser/data/kboot-03/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-03/expected-output [new file with mode: 0644]
test/parser/data/kboot-04/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-04/expected-output [new file with mode: 0644]
test/parser/data/kboot-05/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-05/expected-output [new file with mode: 0644]
test/parser/data/kboot-06/etc/kboot.conf [new file with mode: 0644]
test/parser/data/kboot-06/expected-output [new file with mode: 0644]
test/parser/data/kboot-07/etc/kboot.conf [new file with mode: 0644]
test/parser/data/yaboot-01/etc/yaboot.conf [new file with mode: 0644]
test/parser/data/yaboot-01/expected-output [new file with mode: 0644]
test/parser/data/yaboot-02/etc/yaboot.conf [new file with mode: 0644]
test/parser/data/yaboot-03/etc/yaboot.conf [new file with mode: 0644]
test/parser/data/yaboot-04/etc/yaboot.conf [new file with mode: 0644]
test/parser/data/yaboot-05/etc/yaboot.conf [new file with mode: 0644]
test/parser/data/yaboot-06/etc/yaboot.conf [new file with mode: 0644]
test/parser/parser-test.c [new file with mode: 0644]
test/parser/run-parser-tests.in [new file with mode: 0755]

index c62ef56e872ec67cb6455baeea49da24eb1c106c..b1791cd2a09b4dc1d9450a0aba7fbd6eb2b153e0 100644 (file)
@@ -184,6 +184,7 @@ AC_CONFIG_FILES([
        lib/Makefile
        man/Makefile
        test/Makefile
        lib/Makefile
        man/Makefile
        test/Makefile
+       test/parser/Makefile
        ui/Makefile
        ui/common/Makefile
        ui/ncurses/Makefile
        ui/Makefile
        ui/common/Makefile
        ui/ncurses/Makefile
index 2f0625d163116e51b71c1e0b6d11d26f7827a930..731b8d7e876c30c57d885284359ef37d93aeaef9 100644 (file)
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-AM_CPPFLAGS = \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/lib \
-       -I$(includedir) \
-       $(DEFAULT_CPPFLAGS)
-
-AM_CFLAGS = \
-       $(DEFAULT_CFLAGS)
-
-common_libs = \
-       $(top_builddir)/lib/libpbcore.la \
-       $(top_builddir)/discover/libparser.la
 
 
-noinst_SCRIPTS = parser-test.sh hotplug-device.sh
 
 
-noinst_PROGRAMS = parser-test
+SUBDIRS = parser
 
 
-parser_test_SOURCES = parser-test.c
-parser_test_LDADD = $(common_libs)
+noinst_SCRIPTS = hotplug-device.sh
 
 MAINTAINERCLEANFILES = Makefile.in
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/test/parser-test.c b/test/parser-test.c
deleted file mode 100644 (file)
index 90b3e3b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#define _GNU_SOURCE
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <log/log.h>
-#include "pb-protocol/pb-protocol.h"
-#include <talloc/talloc.h>
-
-#include "discover/device-handler.h"
-#include "discover/parser.h"
-#include "discover/parser-utils.h"
-#include "discover/paths.h"
-
-static FILE *testf;
-
-void device_add_boot_option(struct device *device,
-               struct boot_option *boot_option)
-{
-       fprintf(testf, "%s: %s\n", __func__, device->id);
-       fprintf(testf, " id     '%s'\n", boot_option->id);
-       fprintf(testf, " name   '%s'\n", boot_option->name);
-       fprintf(testf, " descr  '%s'\n", boot_option->description);
-       fprintf(testf, " icon   '%s'\n", boot_option->icon_file);
-       fprintf(testf, " image  '%s'\n", boot_option->boot_image_file);
-       fprintf(testf, " initrd '%s'\n", boot_option->initrd_file);
-       fprintf(testf, " args   '%s'\n", boot_option->boot_args);
-       fflush(testf);
-}
-
-const char *generic_icon_file(
-       enum generic_icon_type __attribute__((unused)) type)
-{
-       return "tester.png";
-}
-
-enum generic_icon_type guess_device_type(
-       struct discover_context __attribute__((unused)) *ctx)
-{
-       return ICON_TYPE_UNKNOWN;
-}
-
-int main(int argc, char **argv)
-{
-       struct discover_context *ctx;
-
-       if (argc != 3) {
-               fprintf(stderr, "usage: %s <basedir> <devname>\n", argv[0]);
-               return EXIT_FAILURE;
-       }
-
-       /* Default to test on stdout, pb_log on stderr. */
-
-       testf = stdout;
-
-       pb_log_set_stream(stderr);
-       pb_log_always_flush(1);
-       pb_log("--- parser-test ---\n");
-
-       ctx = talloc_zero(NULL, struct discover_context);
-
-       ctx->device_path = talloc_asprintf(ctx, "%s/%s", argv[1], argv[2]);
-       ctx->device = talloc_zero(ctx, struct device);
-       ctx->device->id = talloc_strdup(ctx->device, argv[2]);
-
-       iterate_parsers(ctx);
-
-       pb_log("--- end ---\n");
-
-       return EXIT_SUCCESS;
-}
diff --git a/test/parser-test.sh b/test/parser-test.sh
deleted file mode 100755 (executable)
index af54395..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-testdir=parser
-default_rootdev=ps3da1
-mnt=${PREFIX}/var/petitboot/mnt
-
-#set -ex
-
-tests=$(ls ${mnt}/${testdir}/)
-
-for test in $tests
-do
-       rootdev=$default_rootdev
-
-       if [ -e "${mnt}/${testdir}/$test/rootdev" ]; then
-               rootdev=$(cat "${mnt}/${testdir}/$test/rootdev")
-       fi
-
-       ./test/parser-test "${testdir}/$test" $rootdev
-
-#      ./test/parser-test "${testdir}/$test" $rootdev 2>/dev/null |
-#              diff -u "${mnt}/${testdir}/$test/expected-output" -
-done
-
-echo "All tests passed"
diff --git a/test/parser/001/expected-output b/test/parser/001/expected-output
deleted file mode 100644 (file)
index bace9f7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: live
-[opt  0] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
-[opt  0] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
-[opt  0] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
-[opt  0] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
-[opt  1] name: live_nosplash
-[opt  1] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
-[opt  1] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
-[opt  1] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
-[opt  1] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
-[opt  2] name: driverupdates
-[opt  2] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
-[opt  2] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
-[opt  2] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
-[opt  2] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
-[opt  3] name: check
-[opt  3] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
-[opt  3] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
-[opt  3] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
-[opt  3] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
diff --git a/test/parser/001/ps3da1/etc/kboot.conf b/test/parser/001/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index 591c51b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# Ubuntu feisty kboot.conf
-message=/etc/kboot.msg
-timeout=300
-default=live
-live='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --'
-live_nosplash='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet --'
-driverupdates='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --'
-check='/casper/vmlinux initrd=/casper/initrd.gz  boot=casper integrity-check quiet splash --'
-
diff --git a/test/parser/002/expected-output b/test/parser/002/expected-output
deleted file mode 100644 (file)
index 304f15c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: 
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: linux
-[opt  0] description: (null)
-[opt  0] boot_image: devices/parser-tests/002/ps3da1/ppc/ppc64/vmlinux
-[opt  0] initrd: devices/parser-tests/002/ps3da1/ppc/ppc64/ramdisk.image.gz
-[opt  0] boot_args: ro 
diff --git a/test/parser/002/ps3da1/etc/yaboot.conf b/test/parser/002/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index f13b1b3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-init-message = "\nWelcome to the 64-bit Yellow Dog Linux 5.0 installer!\nHit <TAB> for boot options.\n\n"
-timeout=6000
-default=linux
-
-image=/ppc/ppc64/vmlinux
-       label=linux
-       initrd=/ppc/ppc64/ramdisk.image.gz
-       read-only
diff --git a/test/parser/003/expected-output b/test/parser/003/expected-output
deleted file mode 100644 (file)
index 4f60310..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: test
-[opt  0] description: /dev/sda1:/vmlinux
-[opt  0] boot_image: devices/parser-tests/003/ps3da1/vmlinux
-[opt  0] initrd: (null)
-[opt  0] boot_args: (null)
diff --git a/test/parser/003/ps3da1/etc/kboot.conf b/test/parser/003/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index a7bb199..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# test remapping sda to ps3da, when mounted from a ps3da device
-
-test='/dev/sda1:/vmlinux'
-
diff --git a/test/parser/004/expected-output b/test/parser/004/expected-output
deleted file mode 100644 (file)
index 76a90a2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[dev  0] id: /dev/sda1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: test
-[opt  0] description: /dev/sda1:/vmlinux
-[opt  0] boot_image: devices/parser-tests/004/sda1/vmlinux
-[opt  0] initrd: (null)
-[opt  0] boot_args: (null)
diff --git a/test/parser/004/rootdev b/test/parser/004/rootdev
deleted file mode 100644 (file)
index 36cfa0d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-sda1
diff --git a/test/parser/004/sda1/etc/kboot.conf b/test/parser/004/sda1/etc/kboot.conf
deleted file mode 100644 (file)
index 9755f77..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# test remapping sda to ps3da, when mounted from a plain sd device
-
-test='/dev/sda1:/vmlinux'
-
diff --git a/test/parser/005/expected-output b/test/parser/005/expected-output
deleted file mode 100644 (file)
index bfaccc8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: test_uuid
-[opt  0] description: UUID=meep:/vmlinux
-[opt  0] boot_image: devices/parser-tests/005/disk/by-uuid/meep/vmlinux
-[opt  0] initrd: (null)
-[opt  0] boot_args: (null)
-[opt  1] name: test_label
-[opt  1] description: LABEL=meep:/vmlinux
-[opt  1] boot_image: devices/parser-tests/005/disk/by-label/meep/vmlinux
-[opt  1] initrd: (null)
-[opt  1] boot_args: (null)
diff --git a/test/parser/005/ps3da1/etc/kboot.conf b/test/parser/005/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index 72b7db8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# test for LABEL= and UUID= lookups
-
-test_uuid='UUID=meep:/vmlinux'
-test_label='LABEL=meep:/vmlinux'
-
diff --git a/test/parser/101/expected-output b/test/parser/101/expected-output
deleted file mode 100644 (file)
index 45d99a1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: ydl
-[opt  0] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:3 rhgb
-[opt  0] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
-[opt  0] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
-[opt  0] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:3 rhgb
-[opt  1] name: ydl480i
-[opt  1] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:1 rhgb
-[opt  1] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
-[opt  1] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
-[opt  1] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:1 rhgb
-[opt  2] name: ydl1080i
-[opt  2] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:4 rhgb
-[opt  2] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
-[opt  2] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
-[opt  2] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:4 rhgb
-[opt  3] name: ydltext
-[opt  3] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init 3
-[opt  3] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
-[opt  3] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
-[opt  3] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init 3
diff --git a/test/parser/101/ps3da1/etc/kboot.conf b/test/parser/101/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index 4a986c0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# kboot.conf for ydl
-
-default=ydl
-timeout=10
-root=/dev/sda1
-ydl='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:3 rhgb'
-ydl480i='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:1 rhgb'
-ydl1080i='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:4 rhgb'
-ydltext='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init 3'
-
-
-
diff --git a/test/parser/102/expected-output b/test/parser/102/expected-output
deleted file mode 100644 (file)
index cc0d096..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-[dev  0] id: /dev/ps3da1
-[dev  0] name: (null)
-[dev  0] description: (null)
-[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
-[opt  0] name: live
-[opt  0] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
-[opt  0] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
-[opt  0] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
-[opt  0] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
-[opt  1] name: live_nosplash
-[opt  1] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
-[opt  1] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
-[opt  1] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
-[opt  1] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
-[opt  2] name: driverupdates
-[opt  2] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
-[opt  2] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
-[opt  2] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
-[opt  2] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
-[opt  3] name: check
-[opt  3] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
-[opt  3] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
-[opt  3] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
-[opt  3] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
diff --git a/test/parser/102/ps3da1/etc/kboot.conf b/test/parser/102/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index 591c51b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# Ubuntu feisty kboot.conf
-message=/etc/kboot.msg
-timeout=300
-default=live
-live='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --'
-live_nosplash='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet --'
-driverupdates='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --'
-check='/casper/vmlinux initrd=/casper/initrd.gz  boot=casper integrity-check quiet splash --'
-
diff --git a/test/parser/103/ps3da1/etc/kboot.conf b/test/parser/103/ps3da1/etc/kboot.conf
deleted file mode 100644 (file)
index 3f8f15c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-default=tftp_nfs_1080p
-timeout=120
-
-tftp='tftp://192.168.0.5/fire/boot/vmlinux.strip root=/dev/nfs rw ip=dhcp video=1080p'
-nfs='nfs://192.168.0.5/fire/boot/vmlinux.strip root=/dev/nfs rw ip=dhcp video=1080p fbcon=rotate:3'
-http_nfs='http://192.168.0.5/ice/boot/vmlinux.strip nfs://192.168.0.5/ice/boot/initrd root=/dev/nfs'
-
diff --git a/test/parser/201/ps3da1/etc/yaboot.conf b/test/parser/201/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index 8f44792..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# yaboot.conf generated by anaconda
-
-boot=/dev/ps3da
-init-message="Welcome to Fedora!\nHit <TAB> for boot options"
-
-partition=1
-timeout=80
-install=/usr/lib/yaboot/yaboot
-enablecdboot
-enableofboot
-enablenetboot
-nonvram
-mntpoint=/boot/yaboot
-usemount
-
-image=/boot/vmlinuz-2.6.25-1.fc9.ppc64
-       label=2.6.25-1.fc9.pp
-       read-only
-       initrd=/boot/initrd-2.6.25-1.fc9.ppc64.img
-       append="root=UUID=0f1335f2-eaba-4495-8eee-29229bb8ba03"
-
-image=/boot/vmlinuz-2.6.25-0.234.rc9.git1.fc9.ppc64
-       label=linux
-       read-only
-       initrd=/boot/initrd-2.6.25-0.234.rc9.git1.fc9.ppc64.img
-       append="root=UUID=0f1335f2-eaba-4495-8eee-29229bb8ba03"
-
diff --git a/test/parser/202/ps3da1/etc/yaboot.conf b/test/parser/202/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index 56d7062..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# yaboot.conf generated by anaconda
-
-boot=/dev/ps3da
-init-message="Welcome to Fedora!\nHit <TAB> for boot options"
-
-partition=1
-timeout=80
-install=/usr/lib/yaboot/yaboot
-delay=5
-enablecdboot
-enableofboot
-enablenetboot
-nonvram
-mntpoint=/boot/yaboot
-usemount
-
-image=/boot/vmlinuz-2.6.27.5-117.fc10.ppc64
-        label=linux
-        read-only
-        initrd=/boot/initrd-2.6.27.5-117.fc10.ppc64.img
-        append="rhgb quiet root=UUID=ebb54ca2-aa3e-4f67-b1d4-184cdc5d0638"
-
diff --git a/test/parser/203/ps3da1/etc/yaboot.conf b/test/parser/203/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index 57a2f0d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# from openSUSE
-
-message=yaboot.txt
-
-image[32bit]=inst32
-  label=install
-  append="quiet sysrq=1 insmod=sym53c8xx insmod=ipr            "
-image[32bit]=inst32
-  label=slp
-  append="quiet sysrq=1 install=slp           "
-image[32bit]=inst32
-  label=rescue
-  append="quiet sysrq=1 rescue=1              "
-
-
-image[64bit]=inst64
-  label=install
-  append="quiet sysrq=1 insmod=sym53c8xx insmod=ipr            "
-image[64bit]=inst64
-  label=slp
-  append="quiet sysrq=1 install=slp           "
-image[64bit]=inst64
-  label=rescue
-  append="quiet sysrq=1 rescue=1              "
-
diff --git a/test/parser/204/ps3da1/etc/yaboot.conf b/test/parser/204/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index 7537646..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-
-image=111
- read-only
- label=linux1
- label = linux2
- append="abc1"
- append='abc2'
- # read-only
- # label=linux3
- # label = linux4
diff --git a/test/parser/205/ps3da1/etc/yaboot.conf b/test/parser/205/ps3da1/etc/yaboot.conf
deleted file mode 100644 (file)
index fd46206..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# yaboot.conf generated by anaconda
-# from a failed fedora install
-
-boot=/dev/sda2
-init-message="Welcome to Fedora!\nHit <TAB> for boot options"
-
diff --git a/test/parser/Makefile.am b/test/parser/Makefile.am
new file mode 100644 (file)
index 0000000..107e8f1
--- /dev/null
@@ -0,0 +1,80 @@
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; version 2 of the License.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+AM_CPPFLAGS = \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/lib \
+       -I$(includedir) \
+       $(DEFAULT_CPPFLAGS)
+
+AM_CFLAGS = \
+       $(DEFAULT_CFLAGS)
+
+common_libs = \
+       $(top_builddir)/lib/libpbcore.la \
+       $(top_builddir)/discover/libparser.la
+
+noinst_PROGRAMS = parser-test
+
+parser_test_SOURCES = parser-test.c
+parser_test_LDADD = $(common_libs)
+
+noinst_DATA = \
+       data/kboot-01/expected-output \
+       data/kboot-01/etc/kboot.conf \
+       data/kboot-02/expected-output \
+       data/kboot-02/etc/kboot.conf \
+       data/kboot-03/expected-output \
+       data/kboot-03/etc/kboot.conf \
+       data/kboot-04/expected-output \
+       data/kboot-04/etc/kboot.conf \
+       data/kboot-05/expected-output \
+       data/kboot-05/etc/kboot.conf \
+       data/kboot-06/expected-output \
+       data/kboot-06/etc/kboot.conf \
+       data/kboot-07/etc/kboot.conf \
+       data/yaboot-01/expected-output \
+       data/yaboot-01/etc/yaboot.conf \
+       data/yaboot-02/etc/yaboot.conf \
+       data/yaboot-03/etc/yaboot.conf \
+       data/yaboot-04/etc/yaboot.conf \
+       data/yaboot-05/etc/yaboot.conf \
+       data/yaboot-06/etc/yaboot.conf
+
+composed_noinst_scripts = \
+       run-parser-tests
+
+noinst_SCRIPTS = $(composed_noinst_scripts)
+
+edit = sed \
+       -e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \
+       -e 's|@PACKAGE_VERSION\@|$(PACKAGE_VERSION)|g' \
+       -e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \
+       -e 's|@abs_srcdir\@|$(abs_srcdir)|g' \
+       -e 's|@abs_builddir\@|$(abs_builddir)|g' \
+       -e 's|@prefix\@|$(prefix)|g'
+
+run-parser-tests: Makefile $(srcdir)/run-parser-tests.in
+       rm -f $@ $@.tmp
+       $(edit) $(srcdir)/$@.in >$@.tmp
+       chmod +x $@.tmp
+       mv $@.tmp $@
+
+composed_files = $(composed_noinst_scripts)
+
+EXTRA_DIST = $(addsuffix .in, $(composed_files))
+
+MAINTAINERCLEANFILES = Makefile.in
+
+CLEANFILES = $(composed_files) $(addsuffix .tmp, $(composed_files))
diff --git a/test/parser/data/kboot-01/etc/kboot.conf b/test/parser/data/kboot-01/etc/kboot.conf
new file mode 100644 (file)
index 0000000..591c51b
--- /dev/null
@@ -0,0 +1,9 @@
+# Ubuntu feisty kboot.conf
+message=/etc/kboot.msg
+timeout=300
+default=live
+live='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --'
+live_nosplash='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet --'
+driverupdates='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --'
+check='/casper/vmlinux initrd=/casper/initrd.gz  boot=casper integrity-check quiet splash --'
+
diff --git a/test/parser/data/kboot-01/expected-output b/test/parser/data/kboot-01/expected-output
new file mode 100644 (file)
index 0000000..bace9f7
--- /dev/null
@@ -0,0 +1,24 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: live
+[opt  0] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt  0] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
+[opt  0] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
+[opt  0] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt  1] name: live_nosplash
+[opt  1] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt  1] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
+[opt  1] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
+[opt  1] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt  2] name: driverupdates
+[opt  2] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt  2] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
+[opt  2] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
+[opt  2] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt  3] name: check
+[opt  3] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
+[opt  3] boot_image: devices/parser-tests/001/ps3da1/casper/vmlinux
+[opt  3] initrd: devices/parser-tests/001/ps3da1/casper/initrd.gz
+[opt  3] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
diff --git a/test/parser/data/kboot-02/etc/kboot.conf b/test/parser/data/kboot-02/etc/kboot.conf
new file mode 100644 (file)
index 0000000..a7bb199
--- /dev/null
@@ -0,0 +1,4 @@
+# test remapping sda to ps3da, when mounted from a ps3da device
+
+test='/dev/sda1:/vmlinux'
+
diff --git a/test/parser/data/kboot-02/expected-output b/test/parser/data/kboot-02/expected-output
new file mode 100644 (file)
index 0000000..4f60310
--- /dev/null
@@ -0,0 +1,9 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: test
+[opt  0] description: /dev/sda1:/vmlinux
+[opt  0] boot_image: devices/parser-tests/003/ps3da1/vmlinux
+[opt  0] initrd: (null)
+[opt  0] boot_args: (null)
diff --git a/test/parser/data/kboot-03/etc/kboot.conf b/test/parser/data/kboot-03/etc/kboot.conf
new file mode 100644 (file)
index 0000000..9755f77
--- /dev/null
@@ -0,0 +1,4 @@
+# test remapping sda to ps3da, when mounted from a plain sd device
+
+test='/dev/sda1:/vmlinux'
+
diff --git a/test/parser/data/kboot-03/expected-output b/test/parser/data/kboot-03/expected-output
new file mode 100644 (file)
index 0000000..76a90a2
--- /dev/null
@@ -0,0 +1,9 @@
+[dev  0] id: /dev/sda1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: test
+[opt  0] description: /dev/sda1:/vmlinux
+[opt  0] boot_image: devices/parser-tests/004/sda1/vmlinux
+[opt  0] initrd: (null)
+[opt  0] boot_args: (null)
diff --git a/test/parser/data/kboot-04/etc/kboot.conf b/test/parser/data/kboot-04/etc/kboot.conf
new file mode 100644 (file)
index 0000000..72b7db8
--- /dev/null
@@ -0,0 +1,6 @@
+
+# test for LABEL= and UUID= lookups
+
+test_uuid='UUID=meep:/vmlinux'
+test_label='LABEL=meep:/vmlinux'
+
diff --git a/test/parser/data/kboot-04/expected-output b/test/parser/data/kboot-04/expected-output
new file mode 100644 (file)
index 0000000..bfaccc8
--- /dev/null
@@ -0,0 +1,14 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: test_uuid
+[opt  0] description: UUID=meep:/vmlinux
+[opt  0] boot_image: devices/parser-tests/005/disk/by-uuid/meep/vmlinux
+[opt  0] initrd: (null)
+[opt  0] boot_args: (null)
+[opt  1] name: test_label
+[opt  1] description: LABEL=meep:/vmlinux
+[opt  1] boot_image: devices/parser-tests/005/disk/by-label/meep/vmlinux
+[opt  1] initrd: (null)
+[opt  1] boot_args: (null)
diff --git a/test/parser/data/kboot-05/etc/kboot.conf b/test/parser/data/kboot-05/etc/kboot.conf
new file mode 100644 (file)
index 0000000..4a986c0
--- /dev/null
@@ -0,0 +1,12 @@
+# kboot.conf for ydl
+
+default=ydl
+timeout=10
+root=/dev/sda1
+ydl='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:3 rhgb'
+ydl480i='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:1 rhgb'
+ydl1080i='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init video=ps3fb:mode:4 rhgb'
+ydltext='/dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img root=LABEL=/ init=/sbin/init 3'
+
+
+
diff --git a/test/parser/data/kboot-05/expected-output b/test/parser/data/kboot-05/expected-output
new file mode 100644 (file)
index 0000000..45d99a1
--- /dev/null
@@ -0,0 +1,24 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: ydl
+[opt  0] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:3 rhgb
+[opt  0] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
+[opt  0] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
+[opt  0] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:3 rhgb
+[opt  1] name: ydl480i
+[opt  1] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:1 rhgb
+[opt  1] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
+[opt  1] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
+[opt  1] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:1 rhgb
+[opt  2] name: ydl1080i
+[opt  2] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:4 rhgb
+[opt  2] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
+[opt  2] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
+[opt  2] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init video=ps3fb:mode:4 rhgb
+[opt  3] name: ydltext
+[opt  3] description: /dev/sda1:/vmlinux-2.6.22-0.ydl.rc4 root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init 3
+[opt  3] boot_image: devices/parser-tests/101/ps3da1/vmlinux-2.6.22-0.ydl.rc4
+[opt  3] initrd: devices/parser-tests/101/ps3da1/initrd-2.6.22-0.ydl.rc4.img
+[opt  3] boot_args: root=LABEL=/ initrd=/dev/sda1:/initrd-2.6.22-0.ydl.rc4.img  init=/sbin/init 3
diff --git a/test/parser/data/kboot-06/etc/kboot.conf b/test/parser/data/kboot-06/etc/kboot.conf
new file mode 100644 (file)
index 0000000..591c51b
--- /dev/null
@@ -0,0 +1,9 @@
+# Ubuntu feisty kboot.conf
+message=/etc/kboot.msg
+timeout=300
+default=live
+live='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --'
+live_nosplash='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet --'
+driverupdates='/casper/vmlinux initrd=/casper/initrd.gz  file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --'
+check='/casper/vmlinux initrd=/casper/initrd.gz  boot=casper integrity-check quiet splash --'
+
diff --git a/test/parser/data/kboot-06/expected-output b/test/parser/data/kboot-06/expected-output
new file mode 100644 (file)
index 0000000..cc0d096
--- /dev/null
@@ -0,0 +1,24 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: (null)
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: live
+[opt  0] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt  0] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
+[opt  0] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
+[opt  0] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
+[opt  1] name: live_nosplash
+[opt  1] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt  1] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
+[opt  1] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
+[opt  1] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper quiet --
+[opt  2] name: driverupdates
+[opt  2] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt  2] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
+[opt  2] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
+[opt  2] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   file=/cdrom/preseed/ubuntu.seed boot=casper debian-installer/driver-update=true quiet splash --
+[opt  3] name: check
+[opt  3] description: /casper/vmlinux root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
+[opt  3] boot_image: devices/parser-tests/102/ps3da1/casper/vmlinux
+[opt  3] initrd: devices/parser-tests/102/ps3da1/casper/initrd.gz
+[opt  3] boot_args: root=/dev/ram0 initrd=/casper/initrd.gz   boot=casper integrity-check quiet splash --
diff --git a/test/parser/data/kboot-07/etc/kboot.conf b/test/parser/data/kboot-07/etc/kboot.conf
new file mode 100644 (file)
index 0000000..3f8f15c
--- /dev/null
@@ -0,0 +1,7 @@
+default=tftp_nfs_1080p
+timeout=120
+
+tftp='tftp://192.168.0.5/fire/boot/vmlinux.strip root=/dev/nfs rw ip=dhcp video=1080p'
+nfs='nfs://192.168.0.5/fire/boot/vmlinux.strip root=/dev/nfs rw ip=dhcp video=1080p fbcon=rotate:3'
+http_nfs='http://192.168.0.5/ice/boot/vmlinux.strip nfs://192.168.0.5/ice/boot/initrd root=/dev/nfs'
+
diff --git a/test/parser/data/yaboot-01/etc/yaboot.conf b/test/parser/data/yaboot-01/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..f13b1b3
--- /dev/null
@@ -0,0 +1,8 @@
+init-message = "\nWelcome to the 64-bit Yellow Dog Linux 5.0 installer!\nHit <TAB> for boot options.\n\n"
+timeout=6000
+default=linux
+
+image=/ppc/ppc64/vmlinux
+       label=linux
+       initrd=/ppc/ppc64/ramdisk.image.gz
+       read-only
diff --git a/test/parser/data/yaboot-01/expected-output b/test/parser/data/yaboot-01/expected-output
new file mode 100644 (file)
index 0000000..304f15c
--- /dev/null
@@ -0,0 +1,9 @@
+[dev  0] id: /dev/ps3da1
+[dev  0] name: (null)
+[dev  0] description: 
+[dev  0] boot_image: /usr/share/petitboot/artwork/hdd.png
+[opt  0] name: linux
+[opt  0] description: (null)
+[opt  0] boot_image: devices/parser-tests/002/ps3da1/ppc/ppc64/vmlinux
+[opt  0] initrd: devices/parser-tests/002/ps3da1/ppc/ppc64/ramdisk.image.gz
+[opt  0] boot_args: ro 
diff --git a/test/parser/data/yaboot-02/etc/yaboot.conf b/test/parser/data/yaboot-02/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..8f44792
--- /dev/null
@@ -0,0 +1,27 @@
+# yaboot.conf generated by anaconda
+
+boot=/dev/ps3da
+init-message="Welcome to Fedora!\nHit <TAB> for boot options"
+
+partition=1
+timeout=80
+install=/usr/lib/yaboot/yaboot
+enablecdboot
+enableofboot
+enablenetboot
+nonvram
+mntpoint=/boot/yaboot
+usemount
+
+image=/boot/vmlinuz-2.6.25-1.fc9.ppc64
+       label=2.6.25-1.fc9.pp
+       read-only
+       initrd=/boot/initrd-2.6.25-1.fc9.ppc64.img
+       append="root=UUID=0f1335f2-eaba-4495-8eee-29229bb8ba03"
+
+image=/boot/vmlinuz-2.6.25-0.234.rc9.git1.fc9.ppc64
+       label=linux
+       read-only
+       initrd=/boot/initrd-2.6.25-0.234.rc9.git1.fc9.ppc64.img
+       append="root=UUID=0f1335f2-eaba-4495-8eee-29229bb8ba03"
+
diff --git a/test/parser/data/yaboot-03/etc/yaboot.conf b/test/parser/data/yaboot-03/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..56d7062
--- /dev/null
@@ -0,0 +1,22 @@
+# yaboot.conf generated by anaconda
+
+boot=/dev/ps3da
+init-message="Welcome to Fedora!\nHit <TAB> for boot options"
+
+partition=1
+timeout=80
+install=/usr/lib/yaboot/yaboot
+delay=5
+enablecdboot
+enableofboot
+enablenetboot
+nonvram
+mntpoint=/boot/yaboot
+usemount
+
+image=/boot/vmlinuz-2.6.27.5-117.fc10.ppc64
+        label=linux
+        read-only
+        initrd=/boot/initrd-2.6.27.5-117.fc10.ppc64.img
+        append="rhgb quiet root=UUID=ebb54ca2-aa3e-4f67-b1d4-184cdc5d0638"
+
diff --git a/test/parser/data/yaboot-04/etc/yaboot.conf b/test/parser/data/yaboot-04/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..7537646
--- /dev/null
@@ -0,0 +1,10 @@
+
+image=111
+ read-only
+ label=linux1
+ label = linux2
+ append="abc1"
+ append='abc2'
+ # read-only
+ # label=linux3
+ # label = linux4
diff --git a/test/parser/data/yaboot-05/etc/yaboot.conf b/test/parser/data/yaboot-05/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..fd46206
--- /dev/null
@@ -0,0 +1,6 @@
+# yaboot.conf generated by anaconda
+# from a failed fedora install
+
+boot=/dev/sda2
+init-message="Welcome to Fedora!\nHit <TAB> for boot options"
+
diff --git a/test/parser/data/yaboot-06/etc/yaboot.conf b/test/parser/data/yaboot-06/etc/yaboot.conf
new file mode 100644 (file)
index 0000000..57a2f0d
--- /dev/null
@@ -0,0 +1,25 @@
+# from openSUSE
+
+message=yaboot.txt
+
+image[32bit]=inst32
+  label=install
+  append="quiet sysrq=1 insmod=sym53c8xx insmod=ipr            "
+image[32bit]=inst32
+  label=slp
+  append="quiet sysrq=1 install=slp           "
+image[32bit]=inst32
+  label=rescue
+  append="quiet sysrq=1 rescue=1              "
+
+
+image[64bit]=inst64
+  label=install
+  append="quiet sysrq=1 insmod=sym53c8xx insmod=ipr            "
+image[64bit]=inst64
+  label=slp
+  append="quiet sysrq=1 install=slp           "
+image[64bit]=inst64
+  label=rescue
+  append="quiet sysrq=1 rescue=1              "
+
diff --git a/test/parser/parser-test.c b/test/parser/parser-test.c
new file mode 100644 (file)
index 0000000..90b3e3b
--- /dev/null
@@ -0,0 +1,74 @@
+#define _GNU_SOURCE
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <log/log.h>
+#include "pb-protocol/pb-protocol.h"
+#include <talloc/talloc.h>
+
+#include "discover/device-handler.h"
+#include "discover/parser.h"
+#include "discover/parser-utils.h"
+#include "discover/paths.h"
+
+static FILE *testf;
+
+void device_add_boot_option(struct device *device,
+               struct boot_option *boot_option)
+{
+       fprintf(testf, "%s: %s\n", __func__, device->id);
+       fprintf(testf, " id     '%s'\n", boot_option->id);
+       fprintf(testf, " name   '%s'\n", boot_option->name);
+       fprintf(testf, " descr  '%s'\n", boot_option->description);
+       fprintf(testf, " icon   '%s'\n", boot_option->icon_file);
+       fprintf(testf, " image  '%s'\n", boot_option->boot_image_file);
+       fprintf(testf, " initrd '%s'\n", boot_option->initrd_file);
+       fprintf(testf, " args   '%s'\n", boot_option->boot_args);
+       fflush(testf);
+}
+
+const char *generic_icon_file(
+       enum generic_icon_type __attribute__((unused)) type)
+{
+       return "tester.png";
+}
+
+enum generic_icon_type guess_device_type(
+       struct discover_context __attribute__((unused)) *ctx)
+{
+       return ICON_TYPE_UNKNOWN;
+}
+
+int main(int argc, char **argv)
+{
+       struct discover_context *ctx;
+
+       if (argc != 3) {
+               fprintf(stderr, "usage: %s <basedir> <devname>\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+
+       /* Default to test on stdout, pb_log on stderr. */
+
+       testf = stdout;
+
+       pb_log_set_stream(stderr);
+       pb_log_always_flush(1);
+       pb_log("--- parser-test ---\n");
+
+       ctx = talloc_zero(NULL, struct discover_context);
+
+       ctx->device_path = talloc_asprintf(ctx, "%s/%s", argv[1], argv[2]);
+       ctx->device = talloc_zero(ctx, struct device);
+       ctx->device->id = talloc_strdup(ctx->device, argv[2]);
+
+       iterate_parsers(ctx);
+
+       pb_log("--- end ---\n");
+
+       return EXIT_SUCCESS;
+}
diff --git a/test/parser/run-parser-tests.in b/test/parser/run-parser-tests.in
new file mode 100755 (executable)
index 0000000..4c4c2be
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+test="@abs_builddir@/parser-test"
+data_dir="@abs_srcdir@/data"
+mnt_dir="@prefix@/var/petitboot/mnt"
+
+dirs=$(ls ${data_dir})
+
+mkdir -p ${mnt_dir}
+ln -s ${data_dir} ${mnt_dir}/
+
+for d in ${dirs}; do
+       echo "##### running parser test in ${d} #####"
+       ${test} data ${d}
+done