aboutsummaryrefslogtreecommitdiff
path: root/tests/ubi-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ubi-tests')
-rw-r--r--tests/ubi-tests/Makefile24
-rw-r--r--tests/ubi-tests/Makefile.am7
-rw-r--r--tests/ubi-tests/Makemodule.am68
-rwxr-xr-xtests/ubi-tests/runubitests.sh.in (renamed from tests/ubi-tests/runtests.sh)8
-rwxr-xr-xtests/ubi-tests/ubi-stress-test.sh.in (renamed from tests/ubi-tests/stress-test.sh)13
5 files changed, 83 insertions, 37 deletions
diff --git a/tests/ubi-tests/Makefile b/tests/ubi-tests/Makefile
deleted file mode 100644
index c434a6f..0000000
--- a/tests/ubi-tests/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-LIBUBI_PATH = ../../ubi-utils/
-LIBUBI_HEADER_PATH = $(LIBUBI_PATH)/include
-UBIUTILS_PATH=../../ubi-utils/
-
-KERNELHDR := ../../include
-
-LIBS = libubi
-TARGETS=io_update volrefcnt integ io_paral io_read io_basic \
- mkvol_basic mkvol_bad mkvol_paral rsvol
-
-CFLAGS += -I$(LIBUBI_HEADER_PATH) -I $(KERNELHDR)
-LDLIBS += -lpthread
-
-include ../../common.mk
-
-# Compile ubilib with the udevsettle hack
-libubi.a: $(LIBUBI_PATH)/libubi.c $(LIBUBI_HEADER_PATH)/libubi.h $(LIBUBI_PATH)/libubi_int.h
- $(CC) $(CFLAGS) -I $(LIBUBI_PATH) -I../../include -DUDEV_SETTLE_HACK -c $(LIBUBI_PATH)/libubi.c -o libubi.o
- ar cr libubi.a libubi.o
-
-$(TARGETS): $(addprefix $(BUILDDIR)/, helpers.o) libubi.a
-
-clean::
- rm -f libubi.a
diff --git a/tests/ubi-tests/Makefile.am b/tests/ubi-tests/Makefile.am
deleted file mode 100644
index d57316a..0000000
--- a/tests/ubi-tests/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-io_basic_SOURCES = io_basic.c helpers.c
-io_basic_LDADD = libmtd.a libubi.a
-io_basic_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
-
-UBITEST_BINS = io_basic
-
-noinst_PROGRAMS += $(UBITEST_BINS)
diff --git a/tests/ubi-tests/Makemodule.am b/tests/ubi-tests/Makemodule.am
new file mode 100644
index 0000000..805aeaf
--- /dev/null
+++ b/tests/ubi-tests/Makemodule.am
@@ -0,0 +1,68 @@
+io_basic_SOURCES = tests/ubi-tests/io_basic.c tests/ubi-tests/helpers.c
+io_basic_LDADD = libubi.a
+io_basic_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+io_update_SOURCES = tests/ubi-tests/io_update.c tests/ubi-tests/helpers.c
+io_update_LDADD = libubi.a
+io_update_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+io_paral_SOURCES = tests/ubi-tests/io_paral.c tests/ubi-tests/helpers.c
+io_paral_LDADD = libubi.a $(PTHREAD_LIBS)
+io_paral_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+io_paral_LDADD += $(PTHREAD_CFLAGS)
+io_paral_CPPFLAGS += $(PTHREAD_CFLAGS)
+
+io_read_SOURCES = tests/ubi-tests/io_read.c tests/ubi-tests/helpers.c
+io_read_LDADD = libubi.a
+io_read_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+volrefcnt_SOURCES = tests/ubi-tests/volrefcnt.c tests/ubi-tests/helpers.c
+volrefcnt_LDADD = libubi.a
+volrefcnt_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+integ_SOURCES = tests/ubi-tests/integ.c tests/ubi-tests/helpers.c
+integ_LDADD = libubi.a
+integ_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+mkvol_basic_SOURCES = tests/ubi-tests/mkvol_basic.c tests/ubi-tests/helpers.c
+mkvol_basic_LDADD = libubi.a
+mkvol_basic_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+mkvol_bad_SOURCES = tests/ubi-tests/mkvol_bad.c tests/ubi-tests/helpers.c
+mkvol_bad_LDADD = libubi.a
+mkvol_bad_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+mkvol_paral_SOURCES = tests/ubi-tests/mkvol_paral.c tests/ubi-tests/helpers.c
+mkvol_paral_LDADD = libubi.a $(PTHREAD_LIBS)
+mkvol_paral_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+mkvol_paral_LDADD += $(PTHREAD_CFLAGS)
+mkvol_paral_CPPFLAGS += $(PTHREAD_CFLAGS)
+
+rsvol_SOURCES = tests/ubi-tests/rsvol.c tests/ubi-tests/helpers.c
+rsvol_LDADD = libubi.a
+rsvol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
+
+UBITEST_BINS = \
+ io_basic io_update io_paral io_read volrefcnt integ \
+ mkvol_basic mkvol_bad mkvol_paral rsvol
+
+UBITEST_SH = \
+ tests/ubi-tests/runubitests.sh tests/ubi-tests/ubi-stress-test.sh
+
+UBITEST_HEADER = \
+ tests/ubi-tests/helpers.h
+
+UBITEST_EXTRA = \
+ tests/ubi-tests/README.udev
+
+EXTRA_DIST += $(UBITEST_EXTRA) $(UBITEST_HEADER)
+
+if INSTALL_TESTS
+pkglibexec_SCRIPTS += $(UBITEST_SH)
+pkglibexec_PROGRAMS += $(UBITEST_BINS)
+else
+noinst_SCRIPTS += $(UBITEST_SH)
+noinst_PROGRAMS += $(UBITEST_BINS)
+endif
diff --git a/tests/ubi-tests/runtests.sh b/tests/ubi-tests/runubitests.sh.in
index 539ef9d..a1b23c4 100755
--- a/tests/ubi-tests/runtests.sh
+++ b/tests/ubi-tests/runubitests.sh.in
@@ -1,5 +1,11 @@
#!/bin/sh -euf
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libexecpath=@libexecdir@/mtd-utils
+TESTBINDIR=@testbindir@
+
tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update io_paral volrefcnt"
fatal()
@@ -30,7 +36,7 @@ ubidev="$1"
for t in $tests; do
echo "Running $t $ubidev"
- "./$t" "$ubidev" || fatal "$t failed"
+ "$TESTBINDIR/$t" "$ubidev" || fatal "$t failed"
done
echo "SUCCESS"
diff --git a/tests/ubi-tests/stress-test.sh b/tests/ubi-tests/ubi-stress-test.sh.in
index a150495..42ccec5 100755
--- a/tests/ubi-tests/stress-test.sh
+++ b/tests/ubi-tests/ubi-stress-test.sh.in
@@ -1,7 +1,10 @@
#!/bin/sh -euf
-srcdir="$(readlink -ev -- ${0%/*})"
-PATH="$srcdir:$srcdir/../..:$PATH"
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libexecpath=@libexecdir@/mtd-utils
+TESTBINDIR=@testbindir@
fatal()
{
@@ -13,7 +16,7 @@ usage()
{
cat 1>&2 <<EOF
Stress-test an UBI device. This test is basically built on top of
-'runtests.sh' and runs it several times for different configurations.
+'runubitests.sh' and runs it several times for different configurations.
The nandsim and mtdram drivers have to be compiled as kernel modules.
@@ -123,7 +126,7 @@ run_test()
if [ "$module" = "nandsim" ]; then
print_params "$@"
- load_nandsim.sh "$size" "$peb_size" "$page_size" ||
+ $TESTBINDIR/load_nandsim.sh "$size" "$peb_size" "$page_size" ||
echo "Cannot load nandsim, test skipped"
mtdnum="$(find_mtd_device "$nandsim_patt")"
@@ -139,7 +142,7 @@ run_test()
fi
modprobe ubi mtd="$mtdnum,$vid_offs" $fm_param
- runtests.sh /dev/ubi0 ||:
+ $TESTBINDIR/runubitests.sh /dev/ubi0 ||:
sudo rmmod ubi
sudo rmmod "$module"