summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-10-30 21:06:07 +0100
committerGyorgy Sarvari <skandigraun@gmail.com>2025-11-02 15:08:59 +0100
commit01b7c42dfd25f1308113a4de540cfc03a6ae94cb (patch)
tree1fe9d84350bd4b4d73265c3bf10f0abd3049d9e1
parentea936b8f0e469455c347c7af11106686657bc124 (diff)
downloadmeta-openembedded-01b7c42dfd25f1308113a4de540cfc03a6ae94cb.tar.gz
ostree: fix ptests
1. Fix tests that output colored text but try to verify uncolored text - filter the output through "tee" to remove coloring. 2. Add missing dependency 3. Fix a test that fails when C.utf-8 locale is not available on the machine (patch submitted upstream) 4. Enable network connection by setting a nameserver in resolv.conf While execution is possible, it still requires both ostree and busybox to be compiled statically. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
-rw-r--r--meta-oe/recipes-extended/ostree/ostree/run-ptest13
-rw-r--r--meta-oe/recipes-extended/ostree/ostree/tests-account-for-different-locales-in-remote-gpg-list-keys-test.patch102
-rw-r--r--meta-oe/recipes-extended/ostree/ostree_2021.6.bb2
3 files changed, 116 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/ostree/ostree/run-ptest b/meta-oe/recipes-extended/ostree/ostree/run-ptest
index 963d1f6928..adcb278acb 100644
--- a/meta-oe/recipes-extended/ostree/ostree/run-ptest
+++ b/meta-oe/recipes-extended/ostree/ostree/run-ptest
@@ -1,3 +1,14 @@
1#! /bin/sh 1#! /bin/sh
2 2
3gnome-desktop-testing-runner libostree 3if ! nslookup openpgpkey.test.com; then
4 mv /etc/resolv.conf /etc/resolv.conf.bak
5 echo "nameserver 8.8.8.8" > /etc/resolv.conf
6 trap "mv /etc/resolv.conf.bak /etc/resolv.conf" INT EXIT
7fi
8
9# The tests use terminal colors when the output is a tty. This is a problem, because the tests
10# check the output of some commands, which might be colored - and the regex used for matching does not
11# account for the colors. This seemingly useless tee is here to get rid of the colors. (The application
12# doesn't respect the NO_COLOR envvar and doesn't seem to have other options to disable coloring)
13
14gnome-desktop-testing-runner libostree | tee
diff --git a/meta-oe/recipes-extended/ostree/ostree/tests-account-for-different-locales-in-remote-gpg-list-keys-test.patch b/meta-oe/recipes-extended/ostree/ostree/tests-account-for-different-locales-in-remote-gpg-list-keys-test.patch
new file mode 100644
index 0000000000..1b0d9fbed4
--- /dev/null
+++ b/meta-oe/recipes-extended/ostree/ostree/tests-account-for-different-locales-in-remote-gpg-list-keys-test.patch
@@ -0,0 +1,102 @@
1From 9060221fa24ee2d53de416ee4fa15dd5d3668123 Mon Sep 17 00:00:00 2001
2From: Gyorgy Sarvari <skandigraun@gmail.com>
3Date: Thu, 30 Oct 2025 13:43:20 +0100
4Subject: [PATCH] tests: account for different locales in remote-gpg-list-keys
5 test
6
7During test preparation in libtest-core.sh either C or en_US locale
8is set for the test execution.
9
10The remote-gpg-list-keys compares outputs that contain locale-dependent
11dates, but the current test case expects the result to be in C locale.
12
13However in case C.utf-8 locale is not available, but en_US.utf-8 locale
14is available, then the latter will be used, and the testcase will fail,
15because it expects dates to be in this format:
16
17Tue 17 Mar 2015 02:00:32 PM UTC
18
19However with US locale it receives the date like this:
20
21Tue Mar 17 2015 02:00:32 PM UTC
22
23This change converts these dates to the current locale before comparing
24the expected gpg key content with the received one.
25
26Upstream-Status: Submitted [https://github.com/ostreedev/ostree/pull/3545/commits/9060221fa24ee2d53de416ee4fa15dd5d3668123]
27
28Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
29---
30 tests/test-remote-gpg-list-keys.sh | 32 ++++++++++++++++++++----------
31 1 file changed, 22 insertions(+), 10 deletions(-)
32
33diff --git a/tests/test-remote-gpg-list-keys.sh b/tests/test-remote-gpg-list-keys.sh
34index de24bf4da2..a697ecce54 100755
35--- a/tests/test-remote-gpg-list-keys.sh
36+++ b/tests/test-remote-gpg-list-keys.sh
37@@ -61,14 +61,19 @@ echo "ok remote with global keyring"
38 # Import a key and check that it's listed
39 ${OSTREE} remote gpg-import --keyring ${TEST_GPG_KEYHOME}/key1.asc R1
40 ${OSTREE} remote gpg-list-keys R1 > result
41-cat > expected <<"EOF"
42+
43+# In different locales the date is returned differently
44+# Convert the known Creation date to the current locale.
45+EXPECTED_DATE=$(date -d "Tue Sep 10 02:29:42 2013" "+%c")
46+
47+cat > expected <<EOF
48 Key: 5E65DE75AB1C501862D476347FCA23D8472CDAFA
49- Created: Tue Sep 10 02:29:42 2013
50+ Created: $EXPECTED_DATE
51 UID: Ostree Tester <test@test.com>
52 Advanced update URL: https://openpgpkey.test.com/.well-known/openpgpkey/test.com/hu/iffe93qcsgp4c8ncbb378rxjo6cn9q6u?l=test
53 Direct update URL: https://test.com/.well-known/openpgpkey/hu/iffe93qcsgp4c8ncbb378rxjo6cn9q6u?l=test
54 Subkey: CC47B2DFB520AEF231180725DF20F58B408DEA49
55- Created: Tue Sep 10 02:29:42 2013
56+ Created: $EXPECTED_DATE
57 EOF
58 assert_files_equal result expected
59
60@@ -85,28 +90,35 @@ echo "ok global no keyring"
61 OSTREE_GPG_HOME=${trusteddir}
62 ${OSTREE} remote gpg-list-keys > result
63 OSTREE_GPG_HOME=${emptydir}
64-cat > expected <<"EOF"
65+
66+# In different locales the date is returned differently
67+# Convert the known Creation date to the current locale.
68+EXPECTED_DATE=$(date -d "Tue Sep 10 02:29:42 2013" "+%c")
69+EXPECTED_DATE2=$(date -d "Tue Mar 17 14:00:32 2015" "+%c")
70+EXPECTED_DATE3=$(date -d "Tue Mar 17 14:01:05 2015" "+%c")
71+
72+cat > expected <<EOF
73 Key: 5E65DE75AB1C501862D476347FCA23D8472CDAFA
74- Created: Tue Sep 10 02:29:42 2013
75+ Created: $EXPECTED_DATE
76 UID: Ostree Tester <test@test.com>
77 Advanced update URL: https://openpgpkey.test.com/.well-known/openpgpkey/test.com/hu/iffe93qcsgp4c8ncbb378rxjo6cn9q6u?l=test
78 Direct update URL: https://test.com/.well-known/openpgpkey/hu/iffe93qcsgp4c8ncbb378rxjo6cn9q6u?l=test
79 Subkey: CC47B2DFB520AEF231180725DF20F58B408DEA49
80- Created: Tue Sep 10 02:29:42 2013
81+ Created: $EXPECTED_DATE
82 Key: 7B3B1020D74479687FDB2273D8228CFECA950D41
83- Created: Tue Mar 17 14:00:32 2015
84+ Created: $EXPECTED_DATE2
85 UID: Ostree Tester II <test2@test.com>
86 Advanced update URL: https://openpgpkey.test.com/.well-known/openpgpkey/test.com/hu/nnxwsxno46ap6hw7fgphp68j76egpfa9?l=test2
87 Direct update URL: https://test.com/.well-known/openpgpkey/hu/nnxwsxno46ap6hw7fgphp68j76egpfa9?l=test2
88 Subkey: 1EFA95C06EB1EB91754575E004B69C2560D53993
89- Created: Tue Mar 17 14:00:32 2015
90+ Created: $EXPECTED_DATE2
91 Key: 7D29CF060B8269CDF63BFBDD0D15FAE7DF444D67
92- Created: Tue Mar 17 14:01:05 2015
93+ Created: $EXPECTED_DATE3
94 UID: Ostree Tester III <test3@test.com>
95 Advanced update URL: https://openpgpkey.test.com/.well-known/openpgpkey/test.com/hu/8494gyqhmrcs6gn38tn6kgjexet117cj?l=test3
96 Direct update URL: https://test.com/.well-known/openpgpkey/hu/8494gyqhmrcs6gn38tn6kgjexet117cj?l=test3
97 Subkey: 0E45E48CBF7B360C0E04443E0C601A7402416340
98- Created: Tue Mar 17 14:01:05 2015
99+ Created: $EXPECTED_DATE3
100 EOF
101 assert_files_equal result expected
102
diff --git a/meta-oe/recipes-extended/ostree/ostree_2021.6.bb b/meta-oe/recipes-extended/ostree/ostree_2021.6.bb
index b186ba1480..679fd74234 100644
--- a/meta-oe/recipes-extended/ostree/ostree_2021.6.bb
+++ b/meta-oe/recipes-extended/ostree/ostree_2021.6.bb
@@ -19,6 +19,7 @@ DEPENDS = " \
19 19
20SRC_URI = " \ 20SRC_URI = " \
21 gitsm://github.com/ostreedev/ostree;branch=main;protocol=https \ 21 gitsm://github.com/ostreedev/ostree;branch=main;protocol=https \
22 file://tests-account-for-different-locales-in-remote-gpg-list-keys-test.patch \
22 file://run-ptest \ 23 file://run-ptest \
23" 24"
24SRCREV = "f1155c8d283c3c85d74d5e1050b0dcf8198f750a" 25SRCREV = "f1155c8d283c3c85d74d5e1050b0dcf8198f750a"
@@ -196,6 +197,7 @@ RDEPENDS:${PN}-ptest += " \
196 util-linux \ 197 util-linux \
197 xz \ 198 xz \
198 ${PN}-trivial-httpd \ 199 ${PN}-trivial-httpd \
200 ${PN}-switchroot \
199 python3-pyyaml \ 201 python3-pyyaml \
200 ${@bb.utils.contains('PACKAGECONFIG', 'gjs', 'gjs', '', d)} \ 202 ${@bb.utils.contains('PACKAGECONFIG', 'gjs', 'gjs', '', d)} \
201" 203"