Without that fix, running 'make test-recovery-i9300' twice
produces two different images.

With diffoscope we can see that the only differences between
the two images are the gzip timestamps of the initramfs and
the bootimage ID:
    --- tests/recovery-i9300-with-root.img.1
    +++ tests/recovery-i9300-with-root.img
    ├── abootimg -i {}
    │ @@ -13,9 +13,9 @@
    │  * load addresses:
    │    kernel:       0x40008000
    │    ramdisk:      0x41000000
    │    tags:         0x40000100
    │
    │  * cmdline = console=ttySAC2,115200
    │
    │ -* id = 0xbdaf2901 0x9c9b846c 0x229caf97 0x9a73b1e6 0x1403c772 0x00000000 
0x00000000 0x00000000
    │ +* id = 0x7551c944 0x85dcc898 0xbce08232 0x6de196b1 0x39ac56b5 0x00000000 
0x00000000 0x00000000
    ├── initrd.img
    │ ├── filetype from file(1)
    │ │ @@ -1 +1 @@
    │ │ -gzip compressed data, was "ramdisk.cpio", last modified: Thu Sep 30 
18:02:46 2021, from Unix
    │ │ +gzip compressed data, was "ramdisk.cpio", last modified: Thu Sep 30 
18:02:53 2021, from Unix
As in the current mkbootimg python implementation, the ID is
generated from the checksum of various components of the
image, just fixing the gzip command fixes the tests.

Signed-off-by: Denis 'GNUtoo' Carikli <[email protected]>
---
 images/add_adb_root/Makefile                                | 6 +++---
 images/add_adb_root/add_adb_root.py                         | 2 +-
 .../add_adb_root/tests/recovery-i9300-with-root.img.sha512  | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 
images/add_adb_root/tests/recovery-i9300-with-root.img.sha512

diff --git a/images/add_adb_root/Makefile b/images/add_adb_root/Makefile
index 7724ab8..2b290a9 100644
--- a/images/add_adb_root/Makefile
+++ b/images/add_adb_root/Makefile
@@ -25,9 +25,9 @@ tests/recovery-i9300.img:
        mkdir -p tests
        $(CURL) $(MIRROR)/i9300/recovery-i9300.img -o $@
 
-# TODO: test-recovery-i9300 always fails as the resulting image is different
-# at each test
-check: test-recovery-i9100
+check: \
+       test-recovery-i9100 \
+       test-recovery-i9300 \
 
 test-recovery-i9100: tests/recovery-i9100.img
        @./$(PROGNAME) tests/recovery-i9100.img 
tests/recovery-i9100-with-root.img
diff --git a/images/add_adb_root/add_adb_root.py 
b/images/add_adb_root/add_adb_root.py
index bc9e553..c47a90b 100755
--- a/images/add_adb_root/add_adb_root.py
+++ b/images/add_adb_root/add_adb_root.py
@@ -231,7 +231,7 @@ def add_adb_to_bootimage(input_file, output_file):
 
     add_adb_to_ramdisk(ramdisk)
 
-    sh.gzip(ramdisk)
+    sh.gzip("--no-name", ramdisk)
 
     sh.mkbootimg("--base", base_address,
                  "--kernel", kernel,
diff --git a/images/add_adb_root/tests/recovery-i9300-with-root.img.sha512 
b/images/add_adb_root/tests/recovery-i9300-with-root.img.sha512
new file mode 100644
index 0000000..1a5b99a
--- /dev/null
+++ b/images/add_adb_root/tests/recovery-i9300-with-root.img.sha512
@@ -0,0 +1 @@
+bf98e6539f95a2388218f5379bd7cd330821110db866a5e5956864c13684a7b48757f1840dbd5cf29076b4051066790cf0c0d85cc3784d92d4ff6f0891cdff71
  tests/recovery-i9300-with-root.img
-- 
2.33.0

_______________________________________________
Replicant mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to