Package: libusb-1.0
Version: 2:1.0.23-2
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu focal ubuntu-patch

Dear maintainers,

In Ubuntu, we are in the process of moving the i386 architecture to a
compatibility-only layer on amd64, and therefore we are also moving our
autopkgtest infrastructure to test i386 binaries in a cross-environment.

This requires changes to some tests so that they are cross-aware and can
do the right thing.

The libusb-1.0 tests currently fail in this environment, because they
are build tests that do not invoke the toolchain in a cross-aware
manner.  I've verified that the attached patch lets the tests
successfully build (and run) i386 tests on an amd64 host.

Note that upstream autopkgtest doesn't currently set DEB_HOST_ARCH so
thisis a complete no-op in Debian for the moment.  Support for
cross-testing in autopkgtest is currently awaiting review at
https://salsa.debian.org/ci-team/autopkgtest/merge_requests/69 and once
landed, will still have no effect unless autopkgtest is invoked with a
'-a' option.  So this change should be safe to land in your package
despite this not being upstream in autopkgtest.

The patch also change the 'cc' command to 'gcc' since there is currently
no cross arch alias for the first one


Thanks for considering,



diff -Nru libusb-1.0-1.0.23/debian/changelog libusb-1.0-1.0.23/debian/changelog
--- libusb-1.0-1.0.23/debian/changelog	2019-12-30 22:55:13.000000000 +0100
+++ libusb-1.0-1.0.23/debian/changelog	2020-01-07 09:48:47.000000000 +0100
@@ -1,3 +1,11 @@
+libusb-1.0 (2:1.0.23-3) unstable; urgency=medium
+
+  * debian/tests/stress:
+    - Use the correct compiler for proposed autopkgtest cross-testing
+      support. 
+
+ -- Sebastien Bacher <seb...@ubuntu.com>  Tue, 07 Jan 2020 09:47:58 +0100
+
 libusb-1.0 (2:1.0.23-2) unstable; urgency=medium
 
   * Bump Standards-Version to 4.4.1 (no changes).
diff -Nru libusb-1.0-1.0.23/debian/tests/stress libusb-1.0-1.0.23/debian/tests/stress
--- libusb-1.0-1.0.23/debian/tests/stress	2019-08-30 22:18:57.000000000 +0200
+++ libusb-1.0-1.0.23/debian/tests/stress	2020-01-07 09:47:24.000000000 +0100
@@ -5,12 +5,18 @@
 WORKDIR=$(mktemp -d)
 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 
-CFLAGS="-O2 -Wall -Itests $(pkg-config --cflags libusb-1.0)"
-LDFLAGS=$(pkg-config --libs libusb-1.0)
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+    CROSS_COMPILE=
+fi
 
-cc $CFLAGS -o $WORKDIR/stress.o -c tests/stress.c
-cc $CFLAGS -o $WORKDIR/testlib.o -c tests/testlib.c
-cc -o $WORKDIR/stress $WORKDIR/stress.o $WORKDIR/testlib.o $LDFLAGS
+CFLAGS="-O2 -Wall -Itests $(${CROSS_COMPILE}pkg-config --cflags libusb-1.0)"
+LDFLAGS=$(${CROSS_COMPILE}pkg-config --libs libusb-1.0)
+
+${CROSS_COMPILE}gcc $CFLAGS -o $WORKDIR/stress.o -c tests/stress.c
+${CROSS_COMPILE}gcc $CFLAGS -o $WORKDIR/testlib.o -c tests/testlib.c
+${CROSS_COMPILE}gcc -o $WORKDIR/stress $WORKDIR/stress.o $WORKDIR/testlib.o $LDFLAGS
 
 echo "build: OK"
 [ -x $WORKDIR/stress ]

Reply via email to