Skip to content

Commit

Permalink
test: handle more rauc versions
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Olbrich <[email protected]>
  • Loading branch information
michaelolbrich committed Jul 4, 2024
1 parent 68608a3 commit 768eb1f
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 14 deletions.
12 changes: 8 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ EXTRA_DIST += \
test/sparse.config \
test/squashfs.config \
test/tar.config \
test/test.raucb.info \
test/test.raucb.info.new \
test/test2.raucb.info \
test/test2.raucb.info.new \
test/test.raucb.info.1 \
test/test.raucb.info.2 \
test/test.raucb.info.3 \
test/test.raucb.info.4 \
test/test2.raucb.info.1 \
test/test2.raucb.info.2 \
test/test2.raucb.info.3 \
test/test2.raucb.info.4 \
test/ubi.config \
test/ubifs.config \
test/vfat.config
Expand Down
30 changes: 20 additions & 10 deletions test/misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,26 @@ setup_rauc() {
echo "xtest2" > input/rauc2.content
}

version_lt() {
first="$(printf "${1}\n${2}" | sort -V | head -n1)"
test "${first}" == "${1}" && test "${1}" != "${2}"
}

rauc_cmp() {
if version_lt "${rauc_version}" "1.6"; then
test_cmp "${testdir}/${1}.raucb.info.1" "${1}.raucb.info"
elif version_lt "${rauc_version}" "1.9"; then
test_cmp "${testdir}/${1}.raucb.info.2" "${1}.raucb.info"
elif version_lt "${rauc_version}" "1.10"; then
test_cmp "${testdir}/${1}.raucb.info.3" "${1}.raucb.info"
else
test_cmp "${testdir}/${1}.raucb.info.4" "${1}.raucb.info"
fi
}

exec_test_set_prereq rauc
test_expect_success rauc "rauc" "
rauc_version="$(rauc --version | sed 's/rauc //')"
setup_rauc &&
run_genimage rauc.config test.raucb &&
rauc info \
Expand All @@ -45,23 +63,15 @@ test_expect_success rauc "rauc" "
| sed -e 's;O = Test Org, CN = ;/O=Test Org/CN=;' \
-e '/Bundle Format:[ \t]*plain$/d' \
> test.raucb.info &&
if ! grep -r 'Filename:' test.raucb.info; then
test_cmp '${testdir}/test.raucb.info' test.raucb.info
else
test_cmp '${testdir}/test.raucb.info.new' test.raucb.info
fi
rauc_cmp test
rauc info \
--keyring input/rauc-openssl-ca/ca.cert.pem \
--cert input/rauc-openssl-ca/ca.cert.pem \
images/test2.raucb | grep -v cms_get_enveloped_type \
| sed -e 's;O = Test Org, CN = ;/O=Test Org/CN=;' \
-e '/Bundle Format:[ \t]*plain$/d' \
> test2.raucb.info &&
if ! grep -r 'Filename:' test2.raucb.info; then
test_cmp '${testdir}/test2.raucb.info' test2.raucb.info
else
test_cmp '${testdir}/test2.raucb.info.new' test2.raucb.info
fi
rauc_cmp test2
"

exec_test_set_prereq simg2img
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions test/test.raucb.info.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Compatible: 'genimage-test'
Version: '42'
Description: ''genimage rauc test''
Build: '23'
Hooks: ''
Manifest Hash: '396427d8c699c8c1f1c89836dc9883448d1b176477848fff63cdd1bdae1cd1a0'


1 Image:
[rootfs]
Filename: content
Checksum: f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
Size: 5
Hooks:

Certificate Chain:
0 Subject: /O=Test Org/CN=Test Org Development-1
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 79:82:8B:11:2C:F2:78:06:60:4D:09:3B:55:3D:AF:D8:B4:B1:02:9A:D3:AC:40:57:77:1D:D0:AF:E8:B9:9E:90
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT
1 Subject: /O=Test Org/CN=Test Org rauc CA Development
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 09:72:43:C2:97:DA:BB:C6:39:FE:41:84:10:2C:69:9C:6E:8D:AD:06:2F:62:66:A5:CB:15:44:77:E5:DB:BE:AD
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT

27 changes: 27 additions & 0 deletions test/test.raucb.info.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Compatible: 'genimage-test'
Version: '42'
Description: ''genimage rauc test''
Build: '23'
Hooks: ''
Manifest Hash: '396427d8c699c8c1f1c89836dc9883448d1b176477848fff63cdd1bdae1cd1a0'


1 Image:
[rootfs]
Filename: content
Checksum: f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
Size: 5 bytes
Hooks:

Certificate Chain:
0 Subject: /O=Test Org/CN=Test Org Development-1
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 79:82:8B:11:2C:F2:78:06:60:4D:09:3B:55:3D:AF:D8:B4:B1:02:9A:D3:AC:40:57:77:1D:D0:AF:E8:B9:9E:90
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT
1 Subject: /O=Test Org/CN=Test Org rauc CA Development
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 09:72:43:C2:97:DA:BB:C6:39:FE:41:84:10:2C:69:9C:6E:8D:AD:06:2F:62:66:A5:CB:15:44:77:E5:DB:BE:AD
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT

File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions test/test2.raucb.info.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Compatible: 'genimage-test'
Version: '42'
Description: ''genimage rauc test''
Build: '23'
Hooks: ''
Manifest Hash: 'ef0e93a54af2689a033ad524522c4b6b97115bad3ac0b907e01a41221f41e729'


1 Image:
[rootfs]
Filename: data
Checksum: 7d6fd7774f0d87624da6dcf16d0d3d104c3191e771fbe2f39c86aed4b2bf1a0f
Size: 6
Hooks:

Certificate Chain:
0 Subject: /O=Test Org/CN=Test Org Development-1
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 79:82:8B:11:2C:F2:78:06:60:4D:09:3B:55:3D:AF:D8:B4:B1:02:9A:D3:AC:40:57:77:1D:D0:AF:E8:B9:9E:90
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT
1 Subject: /O=Test Org/CN=Test Org rauc CA Development
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 09:72:43:C2:97:DA:BB:C6:39:FE:41:84:10:2C:69:9C:6E:8D:AD:06:2F:62:66:A5:CB:15:44:77:E5:DB:BE:AD
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT

27 changes: 27 additions & 0 deletions test/test2.raucb.info.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Compatible: 'genimage-test'
Version: '42'
Description: ''genimage rauc test''
Build: '23'
Hooks: ''
Manifest Hash: 'ef0e93a54af2689a033ad524522c4b6b97115bad3ac0b907e01a41221f41e729'


1 Image:
[rootfs]
Filename: data
Checksum: 7d6fd7774f0d87624da6dcf16d0d3d104c3191e771fbe2f39c86aed4b2bf1a0f
Size: 6 bytes
Hooks:

Certificate Chain:
0 Subject: /O=Test Org/CN=Test Org Development-1
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 79:82:8B:11:2C:F2:78:06:60:4D:09:3B:55:3D:AF:D8:B4:B1:02:9A:D3:AC:40:57:77:1D:D0:AF:E8:B9:9E:90
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT
1 Subject: /O=Test Org/CN=Test Org rauc CA Development
Issuer: /O=Test Org/CN=Test Org rauc CA Development
SPKI sha256: 09:72:43:C2:97:DA:BB:C6:39:FE:41:84:10:2C:69:9C:6E:8D:AD:06:2F:62:66:A5:CB:15:44:77:E5:DB:BE:AD
Not Before: Jan 1 00:00:00 1970 GMT
Not After: Dec 31 23:59:59 9999 GMT

0 comments on commit 768eb1f

Please sign in to comment.