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>
lib/Makefile
man/Makefile
test/Makefile
+ test/parser/Makefile
ui/Makefile
ui/common/Makefile
ui/ncurses/Makefile
# 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
+++ /dev/null
-#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;
-}
+++ /dev/null
-#!/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"
+++ /dev/null
-[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 --
+++ /dev/null
-# 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 --'
-
+++ /dev/null
-[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
+++ /dev/null
-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
+++ /dev/null
-[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)
+++ /dev/null
-# test remapping sda to ps3da, when mounted from a ps3da device
-
-test='/dev/sda1:/vmlinux'
-
+++ /dev/null
-[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)
+++ /dev/null
-# test remapping sda to ps3da, when mounted from a plain sd device
-
-test='/dev/sda1:/vmlinux'
-
+++ /dev/null
-[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)
+++ /dev/null
-
-# test for LABEL= and UUID= lookups
-
-test_uuid='UUID=meep:/vmlinux'
-test_label='LABEL=meep:/vmlinux'
-
+++ /dev/null
-[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
+++ /dev/null
-# 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'
-
-
-
+++ /dev/null
-[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 --
+++ /dev/null
-# 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 --'
-
+++ /dev/null
-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'
-
+++ /dev/null
-# 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"
-
+++ /dev/null
-# 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"
-
+++ /dev/null
-# 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 "
-
+++ /dev/null
-
-image=111
- read-only
- label=linux1
- label = linux2
- append="abc1"
- append='abc2'
- # read-only
- # label=linux3
- # label = linux4
+++ /dev/null
-# yaboot.conf generated by anaconda
-# from a failed fedora install
-
-boot=/dev/sda2
-init-message="Welcome to Fedora!\nHit <TAB> for boot options"
-
--- /dev/null
+# 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))
--- /dev/null
+# 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 --'
+
--- /dev/null
+[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 --
--- /dev/null
+# test remapping sda to ps3da, when mounted from a ps3da device
+
+test='/dev/sda1:/vmlinux'
+
--- /dev/null
+[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)
--- /dev/null
+# test remapping sda to ps3da, when mounted from a plain sd device
+
+test='/dev/sda1:/vmlinux'
+
--- /dev/null
+[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)
--- /dev/null
+
+# test for LABEL= and UUID= lookups
+
+test_uuid='UUID=meep:/vmlinux'
+test_label='LABEL=meep:/vmlinux'
+
--- /dev/null
+[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)
--- /dev/null
+# 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'
+
+
+
--- /dev/null
+[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
--- /dev/null
+# 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 --'
+
--- /dev/null
+[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 --
--- /dev/null
+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'
+
--- /dev/null
+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
--- /dev/null
+[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
--- /dev/null
+# 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"
+
--- /dev/null
+# 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"
+
--- /dev/null
+
+image=111
+ read-only
+ label=linux1
+ label = linux2
+ append="abc1"
+ append='abc2'
+ # read-only
+ # label=linux3
+ # label = linux4
--- /dev/null
+# yaboot.conf generated by anaconda
+# from a failed fedora install
+
+boot=/dev/sda2
+init-message="Welcome to Fedora!\nHit <TAB> for boot options"
+
--- /dev/null
+# 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 "
+
--- /dev/null
+#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;
+}
--- /dev/null
+#!/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