summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac.in1
-rw-r--r--test/Makefile.am20
-rwxr-xr-xtest/parser-test.sh25
-rw-r--r--test/parser/004/rootdev1
-rw-r--r--test/parser/Makefile.am80
-rw-r--r--test/parser/data/kboot-01/etc/kboot.conf (renamed from test/parser/001/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-01/expected-output (renamed from test/parser/001/expected-output)0
-rw-r--r--test/parser/data/kboot-02/etc/kboot.conf (renamed from test/parser/003/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-02/expected-output (renamed from test/parser/003/expected-output)0
-rw-r--r--test/parser/data/kboot-03/etc/kboot.conf (renamed from test/parser/004/sda1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-03/expected-output (renamed from test/parser/004/expected-output)0
-rw-r--r--test/parser/data/kboot-04/etc/kboot.conf (renamed from test/parser/005/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-04/expected-output (renamed from test/parser/005/expected-output)0
-rw-r--r--test/parser/data/kboot-05/etc/kboot.conf (renamed from test/parser/101/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-05/expected-output (renamed from test/parser/101/expected-output)0
-rw-r--r--test/parser/data/kboot-06/etc/kboot.conf (renamed from test/parser/102/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/kboot-06/expected-output (renamed from test/parser/102/expected-output)0
-rw-r--r--test/parser/data/kboot-07/etc/kboot.conf (renamed from test/parser/103/ps3da1/etc/kboot.conf)0
-rw-r--r--test/parser/data/yaboot-01/etc/yaboot.conf (renamed from test/parser/002/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/data/yaboot-01/expected-output (renamed from test/parser/002/expected-output)0
-rw-r--r--test/parser/data/yaboot-02/etc/yaboot.conf (renamed from test/parser/201/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/data/yaboot-03/etc/yaboot.conf (renamed from test/parser/202/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/data/yaboot-04/etc/yaboot.conf (renamed from test/parser/204/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/data/yaboot-05/etc/yaboot.conf (renamed from test/parser/205/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/data/yaboot-06/etc/yaboot.conf (renamed from test/parser/203/ps3da1/etc/yaboot.conf)0
-rw-r--r--test/parser/parser-test.c (renamed from test/parser-test.c)0
-rwxr-xr-xtest/parser/run-parser-tests.in15
27 files changed, 98 insertions, 44 deletions
diff --git a/configure.ac.in b/configure.ac.in
index c62ef56..b1791cd 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -184,6 +184,7 @@ AC_CONFIG_FILES([
lib/Makefile
man/Makefile
test/Makefile
+ test/parser/Makefile
ui/Makefile
ui/common/Makefile
ui/ncurses/Makefile
diff --git a/test/Makefile.am b/test/Makefile.am
index 2f0625d..731b8d7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -10,26 +10,10 @@
# 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
diff --git a/test/parser-test.sh b/test/parser-test.sh
deleted file mode 100755
index af54395..0000000
--- a/test/parser-test.sh
+++ /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/004/rootdev b/test/parser/004/rootdev
deleted file mode 100644
index 36cfa0d..0000000
--- a/test/parser/004/rootdev
+++ /dev/null
@@ -1 +0,0 @@
-sda1
diff --git a/test/parser/Makefile.am b/test/parser/Makefile.am
new file mode 100644
index 0000000..107e8f1
--- /dev/null
+++ b/test/parser/Makefile.am
@@ -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/001/ps3da1/etc/kboot.conf b/test/parser/data/kboot-01/etc/kboot.conf
index 591c51b..591c51b 100644
--- a/test/parser/001/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-01/etc/kboot.conf
diff --git a/test/parser/001/expected-output b/test/parser/data/kboot-01/expected-output
index bace9f7..bace9f7 100644
--- a/test/parser/001/expected-output
+++ b/test/parser/data/kboot-01/expected-output
diff --git a/test/parser/003/ps3da1/etc/kboot.conf b/test/parser/data/kboot-02/etc/kboot.conf
index a7bb199..a7bb199 100644
--- a/test/parser/003/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-02/etc/kboot.conf
diff --git a/test/parser/003/expected-output b/test/parser/data/kboot-02/expected-output
index 4f60310..4f60310 100644
--- a/test/parser/003/expected-output
+++ b/test/parser/data/kboot-02/expected-output
diff --git a/test/parser/004/sda1/etc/kboot.conf b/test/parser/data/kboot-03/etc/kboot.conf
index 9755f77..9755f77 100644
--- a/test/parser/004/sda1/etc/kboot.conf
+++ b/test/parser/data/kboot-03/etc/kboot.conf
diff --git a/test/parser/004/expected-output b/test/parser/data/kboot-03/expected-output
index 76a90a2..76a90a2 100644
--- a/test/parser/004/expected-output
+++ b/test/parser/data/kboot-03/expected-output
diff --git a/test/parser/005/ps3da1/etc/kboot.conf b/test/parser/data/kboot-04/etc/kboot.conf
index 72b7db8..72b7db8 100644
--- a/test/parser/005/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-04/etc/kboot.conf
diff --git a/test/parser/005/expected-output b/test/parser/data/kboot-04/expected-output
index bfaccc8..bfaccc8 100644
--- a/test/parser/005/expected-output
+++ b/test/parser/data/kboot-04/expected-output
diff --git a/test/parser/101/ps3da1/etc/kboot.conf b/test/parser/data/kboot-05/etc/kboot.conf
index 4a986c0..4a986c0 100644
--- a/test/parser/101/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-05/etc/kboot.conf
diff --git a/test/parser/101/expected-output b/test/parser/data/kboot-05/expected-output
index 45d99a1..45d99a1 100644
--- a/test/parser/101/expected-output
+++ b/test/parser/data/kboot-05/expected-output
diff --git a/test/parser/102/ps3da1/etc/kboot.conf b/test/parser/data/kboot-06/etc/kboot.conf
index 591c51b..591c51b 100644
--- a/test/parser/102/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-06/etc/kboot.conf
diff --git a/test/parser/102/expected-output b/test/parser/data/kboot-06/expected-output
index cc0d096..cc0d096 100644
--- a/test/parser/102/expected-output
+++ b/test/parser/data/kboot-06/expected-output
diff --git a/test/parser/103/ps3da1/etc/kboot.conf b/test/parser/data/kboot-07/etc/kboot.conf
index 3f8f15c..3f8f15c 100644
--- a/test/parser/103/ps3da1/etc/kboot.conf
+++ b/test/parser/data/kboot-07/etc/kboot.conf
diff --git a/test/parser/002/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-01/etc/yaboot.conf
index f13b1b3..f13b1b3 100644
--- a/test/parser/002/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-01/etc/yaboot.conf
diff --git a/test/parser/002/expected-output b/test/parser/data/yaboot-01/expected-output
index 304f15c..304f15c 100644
--- a/test/parser/002/expected-output
+++ b/test/parser/data/yaboot-01/expected-output
diff --git a/test/parser/201/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-02/etc/yaboot.conf
index 8f44792..8f44792 100644
--- a/test/parser/201/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-02/etc/yaboot.conf
diff --git a/test/parser/202/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-03/etc/yaboot.conf
index 56d7062..56d7062 100644
--- a/test/parser/202/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-03/etc/yaboot.conf
diff --git a/test/parser/204/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-04/etc/yaboot.conf
index 7537646..7537646 100644
--- a/test/parser/204/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-04/etc/yaboot.conf
diff --git a/test/parser/205/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-05/etc/yaboot.conf
index fd46206..fd46206 100644
--- a/test/parser/205/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-05/etc/yaboot.conf
diff --git a/test/parser/203/ps3da1/etc/yaboot.conf b/test/parser/data/yaboot-06/etc/yaboot.conf
index 57a2f0d..57a2f0d 100644
--- a/test/parser/203/ps3da1/etc/yaboot.conf
+++ b/test/parser/data/yaboot-06/etc/yaboot.conf
diff --git a/test/parser-test.c b/test/parser/parser-test.c
index 90b3e3b..90b3e3b 100644
--- a/test/parser-test.c
+++ b/test/parser/parser-test.c
diff --git a/test/parser/run-parser-tests.in b/test/parser/run-parser-tests.in
new file mode 100755
index 0000000..4c4c2be
--- /dev/null
+++ b/test/parser/run-parser-tests.in
@@ -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
OpenPOWER on IntegriCloud