summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/binaries/architecture
diff options
context:
space:
mode:
Diffstat (limited to 't/recipes/checks/binaries/architecture')
-rwxr-xr-xt/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/debian/rules12
-rw-r--r--t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/fill-values3
-rw-r--r--t/recipes/checks/binaries/architecture/binaries-misplaced/eval/desc2
-rw-r--r--t/recipes/checks/binaries/architecture/binaries-misplaced/eval/hints1
-rw-r--r--t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/dumpobj22
-rw-r--r--t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/install2
-rwxr-xr-xt/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/rules12
-rw-r--r--t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/fill-values6
-rw-r--r--t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/desc4
-rw-r--r--t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/hints1
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/install1
-rwxr-xr-xt/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/rules22
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/fill-values6
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/Makefile37
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/hello.c8
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/desc2
-rw-r--r--t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/hints1
17 files changed, 142 insertions, 0 deletions
diff --git a/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/debian/rules b/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/debian/rules
new file mode 100755
index 0000000..a3ab46d
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/debian/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+pkg=binaries-misplaced
+%:
+ dh $@
+
+override_dh_install:
+ mkdir -p debian/$(pkg)/etc/
+ cp -a /bin/true debian/$(pkg)/etc/foo
+ # explicitly call dh_shlibdeps since debhelper is being
+ # "smart" and not calling it in newer versions (8.9.something)
+ dh_shlibdeps
+ dh_install
diff --git a/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/fill-values b/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/fill-values
new file mode 100644
index 0000000..6f79eab
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/binaries-misplaced/build-spec/fill-values
@@ -0,0 +1,3 @@
+Skeleton: upload-native
+Testname: binaries-misplaced
+Description: Test binaries in /etc
diff --git a/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/desc b/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/desc
new file mode 100644
index 0000000..4b25873
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/desc
@@ -0,0 +1,2 @@
+Testname: binaries-misplaced
+Check: binaries/architecture
diff --git a/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/hints b/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/hints
new file mode 100644
index 0000000..e724861
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/binaries-misplaced/eval/hints
@@ -0,0 +1 @@
+binaries-misplaced (binary): arch-independent-package-contains-binary-or-object [etc/foo]
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/dumpobj b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/dumpobj
new file mode 100644
index 0000000..afdf68e
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/dumpobj
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+DEB_BUILD_GNU_TYPE="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)"
+
+case $DEB_BUILD_GNU_TYPE in
+i486-linux-gnu|i586-linux-gnu|i686-linux-gnu|x86_64-linux-gnu)
+ base64 -d <<DATA
+f0VMRgEBAQAAAAAAAAAAAAIAKAABAAAAMIEAADQAAAA4bwkAAgAABDQAIAAGACgAGwAaAAEAAHDY
+WgkA2NoJANjaCQBQCgAAUAoAAAQAAAAEAAAAAQAAAAAAAAAAgAAAAIAAAKhlCQCoZQkABQAAAACA
+AAABAAAAqGUJAKhlCgCoZQoAIAgAAOwlAAAGAAAAAIAAAAQAAAD0AAAA9IAAAPSAAAAgAAAAIAAA
+AAQAAAAEAAAABwAAAKhlCQCoZQoAqGUKABgAAAAwAAAABAAAAAQAAABR5XRkAAAAAAAAAAAAAAAA
+AAAAAAAAAAAGAAAABAAAAAQAAAAQAAAAAQAAAEdOVQAAAAAAAgAAAAYAAAASAAAABOAt5QTQTeIR
+AADrBNCN4gTgneQe/y/hAAAAACTAn+UAsKDjBBCd5A0goOEEIC3lBAAt5RAAn+UQMJ/lBMAt5dwS
+DATA
+ ;;
+*)
+ base64 -d <<DATA
+f0VMRgEBMAAwMDAwMDAwMAIAAwABAAAA
+DATA
+ ;;
+esac
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/install b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/install
new file mode 100644
index 0000000..369fa72
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/install
@@ -0,0 +1,2 @@
+debian/elfobject usr/bin/
+debian/fake-guile-object.go usr/lib/foo/binaries-from-other-arch/guile/2.2/
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/rules b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/rules
new file mode 100755
index 0000000..60907d2
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/debian/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+
+DEB_BUILD_OPTIONS := nostrip
+export DEB_BUILD_OPTIONS
+
+%:
+ dh $@
+
+binary:
+ sh debian/dumpobj > debian/elfobject
+ sh debian/dumpobj > debian/fake-guile-object.go
+ dh binary
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/fill-values b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/fill-values
new file mode 100644
index 0000000..d765ecd
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/build-spec/fill-values
@@ -0,0 +1,6 @@
+Skeleton: upload-native
+Testname: binaries-from-other-arch
+Package-Architecture: any
+Dh-Compat-Level: 10
+Description: Test package with a pseudo binary from a different architecture
+# since debhelper 12.5.2, objdump no longer fails silently for compat > 10, need better binary
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/desc b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/desc
new file mode 100644
index 0000000..6f04e39
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/desc
@@ -0,0 +1,4 @@
+Testname: binaries-from-other-arch
+Test-Architectures: amd64 i386
+Check: binaries/architecture/other
+# since debhelper 12.5.2, objdump no longer fails silently for compat > 10, need better binary
diff --git a/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/hints b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/hints
new file mode 100644
index 0000000..fd7b1d8
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/binaries-from-other-arch/eval/hints
@@ -0,0 +1 @@
+binaries-from-other-arch (binary): binary-from-other-architecture [usr/bin/elfobject]
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/install b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/install
new file mode 100644
index 0000000..c10e578
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/install
@@ -0,0 +1 @@
+foreign-binary usr/bin
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/rules b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/rules
new file mode 100755
index 0000000..2ce6f53
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/debian/rules
@@ -0,0 +1,22 @@
+#!/usr/bin/make -f
+
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+%:
+ dh $@
+
+override_dh_strip:
+ # do not try to strip cross-compiled binaries with native tooling
+
+override_dh_shlibdeps:
+ # do not try to include missing libraries
+
+override_dh_dwz:
+ # cross-compiled binaries do not always seem to have a debug section
+
+# In Ubuntu, dh does not catch this file by default.
+# They have diffed it to reduce the size of packages.
+ifneq (,$(strip $(wildcard Changes)))
+override_dh_installchangelogs:
+ dh_installchangelogs Changes
+endif
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/fill-values b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/fill-values
new file mode 100644
index 0000000..24f607a
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/fill-values
@@ -0,0 +1,6 @@
+Skeleton: upload-native
+Testname: wrong-binary-architecture
+Description: Binary architecture does not match package declaration
+Package-Architecture: any
+Extra-Build-Depends:
+ gcc-arm-linux-gnueabihf [amd64 i386], gcc-x86-64-linux-gnu [!amd64 !i386]
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/Makefile b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/Makefile
new file mode 100644
index 0000000..bf92eaf
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/Makefile
@@ -0,0 +1,37 @@
+# This test works on amd64 when the cross-compiler for armhf is installed.
+#
+# The build prerequisite was not added to Lintian, however, since it was
+# not clear how the architecture would be enabled in the Gitlab CI
+# runner.
+#
+# On amd64 or i386, please follow these steps to run the test:
+#
+# dpkg --add-architecture armhf
+# apt update
+# apt install gcc-arm-linux-gnueabihf
+#
+# On all other architectures this may work, but was not tested:
+#
+# dpkg --add-architecture amd64
+# apt update
+# apt install gcc-x86-64-linux-gnu
+#
+# (Taken from: https://wiki.debian.org/CrossToolchains)
+
+ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+
+ifeq ($(ARCH),amd64)
+CC := arm-linux-gnueabihf-gcc
+else
+CC := x86_64-linux-gnu-gcc
+endif
+
+foreign-binary: hello.c
+ $(CC) $^ -o $@
+
+.PHONY: clean
+clean:
+ rm -f foreign-binary
+
+.PHONY: clean
+distclean: clean
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/hello.c b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/hello.c
new file mode 100644
index 0000000..2fb04e1
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/build-spec/orig/hello.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]) {
+
+ printf("Hello, World!\n");
+ exit(0);
+}
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/desc b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/desc
new file mode 100644
index 0000000..8bd95a8
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/desc
@@ -0,0 +1,2 @@
+Testname: wrong-binary-architecture
+Check: binaries/architecture/other
diff --git a/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/hints b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/hints
new file mode 100644
index 0000000..e2251b3
--- /dev/null
+++ b/t/recipes/checks/binaries/architecture/other/wrong-binary-architecture/eval/hints
@@ -0,0 +1 @@
+wrong-binary-architecture (binary): binary-from-other-architecture [usr/bin/foreign-binary]