teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0035-test-do-not-assume-x86-64-arch-in-TEST-58-REPART.patch

594167
From 7cc55d22394b8583b637e7e4b8baa00eb8f0dc49 Mon Sep 17 00:00:00 2001
594167
From: Luca Boccassi <luca.boccassi@microsoft.com>
594167
Date: Wed, 12 Jan 2022 22:38:22 +0000
594167
Subject: [PATCH] test: do not assume x86-64 arch in TEST-58-REPART
594167
594167
(cherry picked from commit 8e65d93e85f06e3f28b0b7a6e33b041ddf119917)
594167
594167
Related: #2017035
594167
---
594167
 test/units/testsuite-58.sh | 76 ++++++++++++++++++++++++++++++++------
594167
 1 file changed, 65 insertions(+), 11 deletions(-)
594167
594167
diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh
594167
index 78c25051a2..4b3c984c84 100755
594167
--- a/test/units/testsuite-58.sh
594167
+++ b/test/units/testsuite-58.sh
594167
@@ -11,6 +11,60 @@ fi
594167
 export SYSTEMD_LOG_LEVEL=debug
594167
 export PAGER=cat
594167
 
594167
+machine="$(uname -m)"
594167
+if [ "${machine}" = "x86_64" ]; then
594167
+    root_guid=4f68bce3-e8cd-4db1-96e7-fbcaf984b709
594167
+    root_uuid=60F33797-1D71-4DCB-AA6F-20564F036CD0
594167
+    usr_guid=8484680c-9521-48c6-9c11-b0720656f69e
594167
+    usr_uuid=7E3369DD-D653-4513-ADF5-B993A9F20C16
594167
+    architecture="x86-64"
594167
+elif [ "${machine}" = "i386" ] || [ "${machine}" = "i686" ] || [ "${machine}" = "x86" ]; then
594167
+    root_guid=44479540-f297-41b2-9af7-d131d5f0458a
594167
+    root_uuid=02b4253f-29a4-404e-8972-1669d3b03c87
594167
+    usr_guid=75250d76-8cc6-458e-bd66-bd47cc81a812
594167
+    usr_uuid=7b42ffb0-b0e1-4395-b20b-c78f4a571648
594167
+    architecture="x86"
594167
+elif [ "${machine}" = "aarch64" ] || [ "${machine}" = "aarch64_be" ] || [ "${machine}" = "armv8b" ] || [ "${machine}" = "armv8l" ]; then
594167
+    root_guid=b921b045-1df0-41c3-af44-4c6f280d3fae
594167
+    root_uuid=055d0227-53a6-4033-85c3-9a5973eff483
594167
+    usr_guid=b0e01050-ee5f-4390-949a-9101b17104e9
594167
+    usr_uuid=fce3c75e-d6a4-44c0-87f0-4c105183fb1f
594167
+    architecture="arm64"
594167
+elif [ "${machine}" = "arm" ]; then
594167
+    root_guid=69dad710-2ce4-4e3c-b16c-21a1d49abed3
594167
+    root_uuid=567da89e-8de2-4499-8d10-18f212dff034
594167
+    usr_guid=7d0359a3-02b3-4f0a-865c-654403e70625
594167
+    usr_uuid=71e93dc2-5073-42cb-8a84-a354e64d8966
594167
+    architecture="arm"
594167
+elif [ "${machine}" = "loongarch64" ]; then
594167
+    root_guid=77055800-792c-4f94-b39a-98c91b762bb6
594167
+    root_uuid=d8efc2d2-0133-41e4-bdcb-3b9f4cfddde8
594167
+    usr_guid=e611c702-575c-4cbe-9a46-434fa0bf7e3f
594167
+    usr_uuid=031ffa75-00bb-49b6-a70d-911d2d82a5b7
594167
+    architecture="loongarch64"
594167
+elif [ "${machine}" = "ia64" ]; then
594167
+    root_guid=993d8d3d-f80e-4225-855a-9daf8ed7ea97
594167
+    root_uuid=dcf33449-0896-4ea9-bc24-7d58aeef522d
594167
+    usr_guid=4301d2a6-4e3b-4b2a-bb94-9e0b2c4225ea
594167
+    usr_uuid=bc2bcce7-80d6-449a-85cc-637424ce5241
594167
+    architecture="ia64"
594167
+elif [ "${machine}" = "s390x" ]; then
594167
+    root_guid=5eead9a9-fe09-4a1e-a1d7-520d00531306
594167
+    root_uuid=7ebe0c85-e27e-48ec-b164-f4807606232e
594167
+    usr_guid=8a4f5770-50aa-4ed3-874a-99b710db6fea
594167
+    usr_uuid=51171d30-35cf-4a49-b8b5-9478b9b796a5
594167
+    architecture="s390x"
594167
+elif [ "${machine}" = "ppc64le" ]; then
594167
+    root_guid=c31c45e6-3f39-412e-80fb-4809c4980599
594167
+    root_uuid=061e67a1-092f-482f-8150-b525d50d6654
594167
+    usr_guid=15bb03af-77e7-4d4a-b12b-c0d084f7491c
594167
+    usr_uuid=c0d0823b-8040-4c7c-a629-026248e297fb
594167
+    architecture="ppc64-le"
594167
+else
594167
+    echo "Unexpected uname -m: ${machine} in testsuite-58.sh, please fix me"
594167
+    exit 1
594167
+fi
594167
+
594167
 rm -f /var/tmp/testsuite-58.img /var/tmp/testsuite-58.2.img /tmp/testsuite-58.dump
594167
 mkdir -p /tmp/testsuite-58-defs/
594167
 
594167
@@ -25,7 +79,7 @@ EOF
594167
 
594167
 cat >/tmp/testsuite-58-defs/usr.conf <
594167
 [Partition]
594167
-Type=usr
594167
+Type=usr-${architecture}
594167
 SizeMinBytes=10M
594167
 Format=ext4
594167
 ReadOnly=yes
594167
@@ -33,7 +87,7 @@ EOF
594167
 
594167
 cat >/tmp/testsuite-58-defs/root.conf <
594167
 [Partition]
594167
-Type=root
594167
+Type=root-${architecture}
594167
 SizeMinBytes=10M
594167
 Format=ext4
594167
 MakeDirectories=/usr /efi
594167
@@ -47,9 +101,9 @@ systemd-repart --definitions=/tmp/testsuite-58-defs/ \
594167
 
594167
 sfdisk --dump /var/tmp/testsuite-58.img | tee /tmp/testsuite-58.dump
594167
 
594167
-grep -qxF '/var/tmp/testsuite-58.img1 : start=        2048, size=       20480, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=39107B09-615D-48FB-BA37-C663885FCE67, name="esp"' /tmp/testsuite-58.dump
594167
-grep -qxF '/var/tmp/testsuite-58.img2 : start=       22528, size=       20480, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=60F33797-1D71-4DCB-AA6F-20564F036CD0, name="root-x86-64", attrs="GUID:59"' /tmp/testsuite-58.dump
594167
-grep -qxF '/var/tmp/testsuite-58.img3 : start=       43008, size=       20480, type=8484680C-9521-48C6-9C11-B0720656F69E, uuid=7E3369DD-D653-4513-ADF5-B993A9F20C16, name="usr-x86-64", attrs="GUID:60"' /tmp/testsuite-58.dump
594167
+grep -qixF "/var/tmp/testsuite-58.img1 : start=        2048, size=       20480, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=39107B09-615D-48FB-BA37-C663885FCE67, name=\"esp\"" /tmp/testsuite-58.dump
594167
+grep -qixF "/var/tmp/testsuite-58.img2 : start=       22528, size=       20480, type=${root_guid}, uuid=${root_uuid}, name=\"root-${architecture}\", attrs=\"GUID:59\"" /tmp/testsuite-58.dump
594167
+grep -qixF "/var/tmp/testsuite-58.img3 : start=       43008, size=       20480, type=${usr_guid}, uuid=${usr_uuid}, name=\"usr-${architecture}\", attrs=\"GUID:60\"" /tmp/testsuite-58.dump
594167
 
594167
 # Second part, duplicate it with CopyBlocks=auto
594167
 
594167
@@ -61,14 +115,14 @@ EOF
594167
 
594167
 cat >/tmp/testsuite-58-defs/usr.conf <
594167
 [Partition]
594167
-Type=usr
594167
+Type=usr-${architecture}
594167
 ReadOnly=yes
594167
 CopyBlocks=auto
594167
 EOF
594167
 
594167
 cat >/tmp/testsuite-58-defs/root.conf <
594167
 [Partition]
594167
-Type=root
594167
+Type=root-${architecture}
594167
 CopyBlocks=auto
594167
 EOF
594167
 
594167
@@ -91,7 +145,7 @@ mkdir -p /tmp/testsuite-58.3-defs/
594167
 
594167
 cat >/tmp/testsuite-58.3-defs/root.conf <
594167
 [Partition]
594167
-Type=root
594167
+Type=root-${architecture}
594167
 EOF
594167
 
594167
 truncate -s 10g /var/tmp/testsuite-58.3.img
594167
@@ -111,7 +165,7 @@ sfdisk --dump /var/tmp/testsuite-58.3.img | tee /tmp/testsuite-58.3.dump
594167
 
594167
 grep -qF '/var/tmp/testsuite-58.3.img1 : start=        2048, size=       69044,' /tmp/testsuite-58.3.dump
594167
 grep -qF '/var/tmp/testsuite-58.3.img2 : start=       71092, size=     3591848,' /tmp/testsuite-58.3.dump
594167
-grep -qxF '/var/tmp/testsuite-58.3.img3 : start=     3662944, size=    17308536, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709, uuid=60F33797-1D71-4DCB-AA6F-20564F036CD0, name="root-x86-64", attrs="GUID:59"' /tmp/testsuite-58.3.dump
594167
+grep -qixF "/var/tmp/testsuite-58.3.img3 : start=     3662944, size=    17308536, type=${root_guid}, uuid=${root_uuid}, name=\"root-${architecture}\", attrs=\"GUID:59\"" /tmp/testsuite-58.3.dump
594167
 
594167
 rm /var/tmp/testsuite-58.3.img /tmp/testsuite-58.3.dump
594167
 rm -r /tmp/testsuite-58.3-defs/
594167
@@ -120,7 +174,7 @@ rm -r /tmp/testsuite-58.3-defs/
594167
 mkdir -p /tmp/testsuite-58-issue-21817-defs/
594167
 truncate -s 100m /tmp/testsuite-58-issue-21817.img
594167
 LOOP=$(losetup -P --show -f /tmp/testsuite-58-issue-21817.img)
594167
-printf 'size=50M,type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709\n,\n' | sfdisk -X gpt /tmp/testsuite-58-issue-21817.img
594167
+printf 'size=50M,type=%s\n,\n' "${root_guid}" | sfdisk -X gpt /tmp/testsuite-58-issue-21817.img
594167
 cat >/tmp/testsuite-58-issue-21817-defs/test.conf <
594167
 [Partition]
594167
 Type=root
594167
@@ -129,7 +183,7 @@ systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ "$
594167
 sfdisk --dump "$LOOP" | tee /tmp/testsuite-58-issue-21817.dump
594167
 losetup -d "$LOOP"
594167
 
594167
-grep -qF 'p1 : start=        2048, size=      102400, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709,' /tmp/testsuite-58-issue-21817.dump
594167
+grep -qiF "p1 : start=        2048, size=      102400, type=${root_guid}," /tmp/testsuite-58-issue-21817.dump
594167
 grep -qF 'p2 : start=      104448, size=      100319,' /tmp/testsuite-58-issue-21817.dump
594167
 
594167
 rm /tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump