From 3f532a297c1fe68c3cfc1be73afa7209cca5aa3a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 18 Mar 2019 03:35:59 -0400 Subject: tests/exe/opkbuild.sh: New test file --- (limited to 'tests') diff --git a/tests/exe/opkbuild.sh b/tests/exe/opkbuild.sh new file mode 100755 index 0000000..d425c1a --- /dev/null +++ b/tests/exe/opkbuild.sh @@ -0,0 +1,86 @@ +# Tests for opkbuild +# +# Copyright (C) 2019 Patrick McDermott +# +# This file is part of opkbuild. +# +# opkbuild 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, either version 3 of the License, or +# (at your option) any later version. +# +# opkbuild 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 opkbuild. If not, see . + +set -eu + +. "${TOP_SRCDIR}/tests/aux/tap-functions.sh" +. "${TOP_SRCDIR}/tests/aux/common.sh" + +ls_outer() +{ + local opk="${1}" + shift 1 + + tar -tzf "${opk}" | LC_ALL=POSIX sort +} + +ls_inner() +{ + local opk="${1}" + local mbr="${2}" + shift 2 + + tar -xzOf "${opk}" "${mbr}" | tar -tz | LC_ALL=POSIX sort +} + +plan_ 12 + +# Get out of and remove the work area. +cd '../' +rm -Rf 'src/' 'tmp/' +cp -Rp '../src/' 'src/' + +command_ok_ 'opkbuild exit status' -- opkbuild -a i686-linux-glibc -p x60 -c +for opk in '../src-foo_1.0-1_src_all.opk' \ + '../foo_1.0-1_i686-linux-glibc_all.opk' \ + '../bar_1.0-1_all_all.opk'; do + command_ok_ 'opk exists' -- [ -f "${opk}" ] + cmd_is 'outer archive contents' ls_outer "${opk}" <<-EOF + control.tar.gz + data.tar.gz + debian-binary + EOF + cmd_is 'control.tar.gz contents' ls_inner "${opk}" control.tar.gz <<-EOF + ./ + ./control + ./md5sums + EOF +done +cmd_is 'data.tar.gz contents' \ + ls_inner '../foo_1.0-1_i686-linux-glibc_all.opk' data.tar.gz <<-EOF + ./ + ./usr/ + ./usr/bin/ + ./usr/bin/foo.sh + ./usr/share/ + ./usr/share/doc/ + ./usr/share/doc/foo/ + ./usr/share/doc/foo/README.dist + ./usr/share/doc/foo/README.upstream + ./usr/share/doc/foo/changelog.dist + ./usr/share/doc/foo/copyright + EOF +cmd_is 'data.tar.gz contents' \ + ls_inner '../bar_1.0-1_all_all.opk' data.tar.gz <<-EOF + ./ + ./usr/ + ./usr/share/ + ./usr/share/doc/ + ./usr/share/doc/bar + EOF diff --git a/tests/local.mk b/tests/local.mk index 068fd55..48ec103 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -12,7 +12,8 @@ TESTS = \ %reldir%/exe/ob-installdocs.sh \ %reldir%/exe/ob-gencontrol.sh \ %reldir%/exe/ob-buildopk.sh \ - %reldir%/exe/ob-genchanges.sh + %reldir%/exe/ob-genchanges.sh \ + %reldir%/exe/opkbuild.sh TEST_EXTENSIONS = .sh SH_LOG_DRIVER = \ AM_TAP_AWK='$(AWK)' \ @@ -23,6 +24,7 @@ SH_LOG_DRIVER = \ OB_LIB_BUILDDIR="$(abs_top_builddir)/locale" \ OB_EXE_BUILDDIR="$(abs_top_builddir)/locale" \ SHLD_LIBRARY_PATH="$(abs_top_builddir)/lib" \ + OB_BINDIR="$(abs_top_builddir)/src" \ PATH="$(abs_top_builddir)/src:$${PATH}" \ $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh EXTRA_DIST += \ -- cgit v0.9.1