From 529fb12cb56c379a3364a731201e411300b6ad7a Mon Sep 17 00:00:00 2001
From: Patrick McDermott <patrick.mcdermott@libiquity.com>
Date: Sun, 17 Mar 2019 17:12:55 -0400
Subject: tests/aux/common.sh: Set SPF 2.0 env vars

Don't bother setting these in every test script.

Also set a non-native package version in tests/aux/setup.sh.
---
(limited to 'tests')

diff --git a/tests/aux/common.sh b/tests/aux/common.sh
index 896790f..2ebdc9e 100644
--- a/tests/aux/common.sh
+++ b/tests/aux/common.sh
@@ -69,3 +69,26 @@ cmd_is()
 }
 
 cd "${TOP_BUILDDIR}/tests/pkg/tmp/"
+
+# SPF 2.0 environment variables:
+#   <http://specs.proteanos.com/spf-2.0/buildsys.html#env-vars>
+# Section 7.3.1 Package Variables
+export OPK_SOURCE='foo'
+export OPK_SOURCE_VERSION='1.0-1'
+export OPK_SOURCE_VERSION_UPSTREAM='1.0'
+export OPK_BINARY_VERSION='1.0-1'
+export OPK_PACKAGES=''  # TODO
+# Section 7.3.2 Build and Host System Variables
+# OPK_BUILD_ARCH_GNU and OPK_HOST_ARCH_GNU aren't set or used by opkbuild
+# utilities.  These should be removed from the SPF.
+export OPK_BUILD_ARCH='amd64-linux-glibc'
+export OPK_BUILD_ARCH_CPU='amd64'
+export OPK_BUILD_ARCH_KERNEL='linux'
+export OPK_BUILD_ARCH_LIBS='glibc'
+export OPK_BUILD_PLAT='dev'
+export OPK_HOST_ARCH='i686-linux-glibc'
+export OPK_HOST_ARCH_CPU='i686'
+export OPK_HOST_ARCH_KERNEL='linux'
+export OPK_HOST_ARCH_LIBS='glibc'
+export OPK_HOST_PLAT='x60'
+# Section 7.3.3 Toolchain Variables aren't used by opkbuild utilities.
diff --git a/tests/aux/setup.sh b/tests/aux/setup.sh
index 0d42223..ca91b8c 100644
--- a/tests/aux/setup.sh
+++ b/tests/aux/setup.sh
@@ -36,7 +36,7 @@ cat >'control' <<-EOF
 	EOF
 
 cat >'changelog' <<-EOF
-	foo (1.0) trunk
+	foo (1.0-1) trunk
 	  * Initial release.
 	 -- ${MAINTAINER}  Thu, 01 Jan 1970 00:00:00 +0000
 	EOF
diff --git a/tests/exe/ob-buildenv.sh b/tests/exe/ob-buildenv.sh
index 4440fd2..3720207 100755
--- a/tests/exe/ob-buildenv.sh
+++ b/tests/exe/ob-buildenv.sh
@@ -24,22 +24,21 @@ set -eu
 
 plan_ 1
 
-OPK_BUILD_ARCH='amd64-linux-glibc' OPK_HOST_ARCH='i686-linux-glibc' \
-	cmd_is 'ob-buildenv' ob-buildenv <<-EOF
-		PATH='${PATH}'
-		AR='i686-linux-glibc-ar'
-		AS='i686-linux-glibc-as'
-		CC='i686-linux-glibc-gcc'
-		CPP='i686-linux-glibc-cpp'
-		CXX='i686-linux-glibc-g++'
-		LD='i686-linux-glibc-ld'
-		NM='i686-linux-glibc-nm'
-		OBJCOPY='i686-linux-glibc-objcopy'
-		OBJDUMP='i686-linux-glibc-objdump'
-		RANLIB='i686-linux-glibc-ranlib'
-		READELF='i686-linux-glibc-readelf'
-		SIZE='i686-linux-glibc-size'
-		STRINGS='i686-linux-glibc-strings'
-		STRIP='i686-linux-glibc-strip'
-		OPK_TOOL_PREFIX='i686-linux-glibc-'
-		EOF
+cmd_is 'ob-buildenv' ob-buildenv <<-EOF
+	PATH='${PATH}'
+	AR='i686-linux-glibc-ar'
+	AS='i686-linux-glibc-as'
+	CC='i686-linux-glibc-gcc'
+	CPP='i686-linux-glibc-cpp'
+	CXX='i686-linux-glibc-g++'
+	LD='i686-linux-glibc-ld'
+	NM='i686-linux-glibc-nm'
+	OBJCOPY='i686-linux-glibc-objcopy'
+	OBJDUMP='i686-linux-glibc-objdump'
+	RANLIB='i686-linux-glibc-ranlib'
+	READELF='i686-linux-glibc-readelf'
+	SIZE='i686-linux-glibc-size'
+	STRINGS='i686-linux-glibc-strings'
+	STRIP='i686-linux-glibc-strip'
+	OPK_TOOL_PREFIX='i686-linux-glibc-'
+	EOF
diff --git a/tests/exe/ob-unpacksource.sh b/tests/exe/ob-unpacksource.sh
index 375bb1e..ddc382a 100755
--- a/tests/exe/ob-unpacksource.sh
+++ b/tests/exe/ob-unpacksource.sh
@@ -33,8 +33,7 @@ plan_ 4
 mkdir -p '../src/src/'
 printf '%s' "${FOO_SH}" >'../src/src/foo.sh'
 
-OPK_SOURCE='foo' OPK_SOURCE_VERSION_UPSTREAM='1.0' \
-	command_ok_ 'ob-unpacksource exit status' ob-unpacksource
+command_ok_ 'ob-unpacksource exit status' ob-unpacksource
 cmd_is 'native sources unpacked' cat 'src/src/foo.sh' <<-EOF
 	${FOO_SH}
 	EOF
@@ -45,8 +44,7 @@ mv '../src/' 'foo/'
 tar -czf '../foo-1.0.orig.tar.gz' 'foo/'
 rm -Rf 'foo/'
 
-OPK_SOURCE='foo' OPK_SOURCE_VERSION_UPSTREAM='1.0' \
-	command_ok_ 'ob-unpacksource exit status' ob-unpacksource
+command_ok_ 'ob-unpacksource exit status' ob-unpacksource
 cmd_is 'upstream sources unpacked' cat 'src/src/foo.sh' <<-EOF
 	${FOO_SH}
 	EOF
--
cgit v0.9.1