From 5d2a788e418fa2d05d4488ec1bcd2fcd122abd9a Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Fri, 9 May 2025 13:40:56 +0200 Subject: [PATCH] 7zip reader: add test for POWERPC filter support for LZMA compressor (#2460) This new test archive contains a C hello world executable built like so on a ubuntu 24.04 machine: ``` int main(int argc, char *argv[]) { printf("hello, world\n"); return 0; } ``` `powerpc-linux-gnu-gcc hw.c -o hw-powerpc -Wall` The test archive that contains this executable was created like so, using 7-Zip 24.08: `7zz a -t7z -m0=lzma2 -mf=ppc libarchive/test/test_read_format_7zip_lzma2_powerpc.7z hw-powerpc` The new test archive is required because the powerpc filter for lzma is implemented in liblzma rather than in libarchive. --- Makefile.am | 1 + libarchive/test/test_read_format_7zip.c | 16 +++++++ .../test_read_format_7zip_lzma2_powerpc.7z.uu | 48 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu diff --git a/Makefile.am b/Makefile.am index 5d7abc13b..acb9003a1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -813,6 +813,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_7zip_lzma2.7z.uu \ libarchive/test/test_read_format_7zip_lzma2_arm64.7z.uu \ libarchive/test/test_read_format_7zip_lzma2_arm.7z.uu \ + libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu \ libarchive/test/test_read_format_7zip_lzma2_riscv.7z.uu \ libarchive/test/test_read_format_7zip_lzma2_sparc.7z.uu \ libarchive/test/test_read_format_7zip_malformed.7z.uu \ diff --git a/libarchive/test/test_read_format_7zip.c b/libarchive/test/test_read_format_7zip.c index 187c02ff8..49a918de9 100644 --- a/libarchive/test/test_read_format_7zip.c +++ b/libarchive/test/test_read_format_7zip.c @@ -1499,3 +1499,19 @@ DEFINE_TEST(test_read_format_7zip_deflate_powerpc) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } + +DEFINE_TEST(test_read_format_7zip_lzma2_powerpc) +{ + struct archive *a; + + assert((a = archive_read_new()) != NULL); + + if (ARCHIVE_OK != archive_read_support_filter_gzip(a)) { + skipping( + "7zip:deflate decoding is not supported on this platform"); + } else { + test_powerpc_filter("test_read_format_7zip_lzma2_powerpc.7z"); + } + + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu b/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu new file mode 100644 index 000000000..75940eadc --- /dev/null +++ b/libarchive/test/test_read_format_7zip_lzma2_powerpc.7z.uu @@ -0,0 +1,48 @@ +begin 664 libarchive/test/test_read_format_7zip_lzma2_powerpc.7z +M-WJ\KR<<``3$^AU-00<```````!R`````````-SC-5?A"O,'.5T`/Y%%A&@T +MB@D*0&*NI,NQR,0S-H]24V>HUJ)S8G8?UTBL>Q5 +MG.4VRG`GX;NVN!)QZV9EE-86\EX/-AGSD8"!_9OCIVXS85?#W'27\3@+6C5[ +MNF\X^*^Y;RXP>O=WDX`WFTS!C`ZZ+4=K-.AWX[@*@)]I$[S64O;XZL +MAMD8<%,25+2ZFN6C=QD/7BQW"%!J\Q]5:/P\JOWIO1&Z)XJPAH]RU>Q=R:'" +M1.D[?\\09!A4R'EED]]!$(`P\VJ>\*'QH^,1[W<'/KHPYR\>YQ>)7;$Q1$2Q +MT;Y'@(N5GF.QDBD^[&@!Z7!)8T:A8G>LO#(-C]Q]RQ+RP8)+;A49<3:R@[<. +M6QP1PPEA<]\\J&[Z4Q.3D4JF=[9(>PZ;PH1=9X$OB2+-JWD+(MY@9)+.RBE\ +M-(YGOM"(P#:$I2]OP+Z`!T:_-7`>%UH]^X%9I;=?%F'`?%@SZGPK7U7P.NY1 +MO^(M\S$TG0-!QBLO4NVWI'9=V=59:L$<)=R(B=><7E`EHU>+9U:R60*?H+;L:IXHASE[EX="AL9^\TE8<]4\'P<.8X63DC$%-'EF2+XYRU/NJEAQ8^I(QUY>=IH']H+>E?4H15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