aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Barnett <ryanbarnett3@gmail.com>2021-09-23 11:13:37 -0500
committerAndy Postnikov <apostnikov@gmail.com>2021-09-23 21:29:15 +0000
commitf65bb4292b299f45a078512118fb3c4f2892c92f (patch)
tree6d82a9e8476be81b82c3e3244e4a98991a28e98d
parentd8eb6a4b40376bfe2d1181be1e852f45a35681e1 (diff)
testing/squashfs-tools-ng: upgrade to 1.1.3
Pulled in patch for fixing test case for ABI on x86. Fixes issue with incorrect struct assumptio. https://github.com/AgentD/squashfs-tools-ng/issues/93 Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com>
-rw-r--r--testing/squashfs-tools-ng/0001-Fix-struct-offset-testing-in-ABI-test-case.patch127
-rw-r--r--testing/squashfs-tools-ng/APKBUILD9
2 files changed, 133 insertions, 3 deletions
diff --git a/testing/squashfs-tools-ng/0001-Fix-struct-offset-testing-in-ABI-test-case.patch b/testing/squashfs-tools-ng/0001-Fix-struct-offset-testing-in-ABI-test-case.patch
new file mode 100644
index 00000000000..a55d51f33bb
--- /dev/null
+++ b/testing/squashfs-tools-ng/0001-Fix-struct-offset-testing-in-ABI-test-case.patch
@@ -0,0 +1,127 @@
+From 349a98c2153f6d993c926007cb9eb7cc386c1be0 Mon Sep 17 00:00:00 2001
+From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+Date: Sun, 12 Sep 2021 23:52:40 +0200
+Subject: [PATCH 1/2] Fix struct offset testing in ABI test case
+
+The intention of the (severely incomplete) ABI test case is to detect
+changes to the ABI of libsquashfs. Currently it tries to blurt out if
+the layout of some structure is changed unintentionally.
+
+Unfortunately, the test uses some unportable assumptions. Among other
+things, it was assumed that a 64 bit field will always require 64 bit
+alignment. This is apparently no the case on 32 bit x86.
+
+This patch makes the check work on 32 bit and 64 bit x86, by adding
+an additional runtime check that relies on the __alignof__ extension
+offered by gcc and clang (the only 2 compilers that are really
+supported at the moment).
+
+Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
+[Retrieved from https://github.com/AgentD/squashfs-tools-ng/issues/93]
+Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com>
+---
+ tests/libsqfs/abi.c | 71 +++++++++++++++++++++++++++++++++------------
+ 1 file changed, 52 insertions(+), 19 deletions(-)
+
+diff --git a/tests/libsqfs/abi.c b/tests/libsqfs/abi.c
+index 04bbc30..d409f67 100644
+--- a/tests/libsqfs/abi.c
++++ b/tests/libsqfs/abi.c
+@@ -35,8 +35,14 @@ static void test_compressor_opt_struct(void)
+ sizeof(sqfs_u32));
+ TEST_EQUAL_UI(offsetof(sqfs_compressor_config_t, level),
+ (2 * sizeof(sqfs_u32)));
+- TEST_EQUAL_UI(offsetof(sqfs_compressor_config_t, opt),
+- (4 * sizeof(sqfs_u32)));
++
++ if (__alignof__(sqfs_compressor_config_t) == __alignof__(sqfs_u32)) {
++ TEST_EQUAL_UI(offsetof(sqfs_compressor_config_t, opt),
++ (3 * sizeof(sqfs_u32)));
++ } else if (__alignof__(sqfs_compressor_config_t) == __alignof__(sqfs_u64)) {
++ TEST_EQUAL_UI(offsetof(sqfs_compressor_config_t, opt),
++ (4 * sizeof(sqfs_u32)));
++ }
+ }
+
+ static const char *names[] = {
+@@ -65,33 +71,60 @@ static void test_compressor_names(void)
+ static void test_blockproc_stats(void)
+ {
+ sqfs_block_processor_stats_t stats;
++ size_t off;
++
++ TEST_EQUAL_UI(sizeof(stats.size), sizeof(size_t));
++ TEST_EQUAL_UI(sizeof(stats.input_bytes_read), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.output_bytes_generated), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.data_block_count), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.frag_block_count), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.sparse_block_count), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.total_frag_count), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(sizeof(stats.actual_frag_count), sizeof(sqfs_u64));
+
+- TEST_ASSERT(sizeof(stats) >= (8 * sizeof(sqfs_u64)));
++ if (__alignof__(stats) == __alignof__(sqfs_u32)) {
++ TEST_ASSERT(sizeof(stats) >=
++ (sizeof(sqfs_u32) + 7 * sizeof(sqfs_u64)));
++ } else if (__alignof__(stats) == __alignof__(sqfs_u64)) {
++ TEST_ASSERT(sizeof(stats) >= (8 * sizeof(sqfs_u64)));
++ }
+
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t, size), 0);
++
++ if (sizeof(size_t) < sizeof(sqfs_u64) &&
++ (__alignof__(sqfs_block_processor_stats_t) ==
++ __alignof__(sqfs_u64))) {
++ off = sizeof(sqfs_u64);
++ } else {
++ off = sizeof(stats.size);
++ }
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- input_bytes_read), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- output_bytes_generated), 2 * sizeof(sqfs_u64));
++ input_bytes_read), off);
++ off += sizeof(sqfs_u64);
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- data_block_count), 3 * sizeof(sqfs_u64));
++ output_bytes_generated), off);
++ off += sizeof(sqfs_u64);
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- frag_block_count), 4 * sizeof(sqfs_u64));
++ data_block_count), off);
++ off += sizeof(sqfs_u64);
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- sparse_block_count), 5 * sizeof(sqfs_u64));
++ frag_block_count), off);
++ off += sizeof(sqfs_u64);
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- total_frag_count), 6 * sizeof(sqfs_u64));
++ sparse_block_count), off);
++ off += sizeof(sqfs_u64);
++
+ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
+- actual_frag_count), 7 * sizeof(sqfs_u64));
++ total_frag_count), off);
++ off += sizeof(sqfs_u64);
+
+- TEST_EQUAL_UI(sizeof(stats.size), sizeof(size_t));
+- TEST_EQUAL_UI(sizeof(stats.input_bytes_read), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.output_bytes_generated), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.data_block_count), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.frag_block_count), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.sparse_block_count), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.total_frag_count), sizeof(sqfs_u64));
+- TEST_EQUAL_UI(sizeof(stats.actual_frag_count), sizeof(sqfs_u64));
++ TEST_EQUAL_UI(offsetof(sqfs_block_processor_stats_t,
++ actual_frag_count), off);
+ }
+
+ static void test_blockproc_desc(void)
+--
+2.31.1
+
diff --git a/testing/squashfs-tools-ng/APKBUILD b/testing/squashfs-tools-ng/APKBUILD
index 0eacbd8f6cb..c323c6f0590 100644
--- a/testing/squashfs-tools-ng/APKBUILD
+++ b/testing/squashfs-tools-ng/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Ryan Barnett <ryanbarnett3@gmail.com>
# Maintainer: Ryan Barnett <ryanbarnett3@gmail.com>
pkgname=squashfs-tools-ng
-pkgver=1.1.2
+pkgver=1.1.3
pkgrel=0
pkgdesc="A new set of tools and libraries for working with SquashFS images"
url="https://infraroot.at/projects/squashfs-tools-ng/index.html"
@@ -9,7 +9,9 @@ arch="all"
license="GPL-3.0-or-later"
makedepends="automake libselinux-dev lz4-dev lzo-dev xz-dev zlib-dev zstd-dev"
subpackages="$pkgname-dev $pkgname-libs $pkgname-doc"
-source="https://infraroot.at/pub/squashfs/squashfs-tools-ng-$pkgver.tar.gz"
+source="https://infraroot.at/pub/squashfs/squashfs-tools-ng-$pkgver.tar.gz
+ 0001-Fix-struct-offset-testing-in-ABI-test-case.patch
+ "
build() {
./configure \
@@ -30,4 +32,5 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="7ab22f4e92c0112303892b6a79d5ad886b0552f349fbadc3ad477f37ab653378d363cba5f555fb94f41c5bb1910a3f6b459c067b19027122a074182791c95f4f squashfs-tools-ng-1.1.2.tar.gz"
+sha512sums="7bd2c1f1f5b0443e34594b5899591bef03b50f10755d12062e38e09a831f791859460184e53e288d33fc7690d6d32b94e162afe2e0234b62e2dc2b977972cf5e squashfs-tools-ng-1.1.3.tar.gz
+9358ce93bb7ea6e8d9376548c4e32f271b7cc88adad845cd91c707cef30fa4442607621d4e0ac9b2ab8ab791ca90fa11516b99f47287c1af1cb53a33fc6dd887 0001-Fix-struct-offset-testing-in-ABI-test-case.patch"