diff options
author | Dan Nicholson <nicholson@endlessm.com> | 2019-07-08 15:08:07 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-07-23 12:49:26 +0000 |
commit | 615861443be250cba16d674a6b3c7f96c8b842de (patch) | |
tree | 8809d1c2435968fc63cb4f9aa4b98ebc9c3ed9a5 | |
parent | 2312caad7633d7aae11adebd87e4f932431bf49a (diff) | |
download | ostree-615861443be250cba16d674a6b3c7f96c8b842de.tar.gz |
tests/sizes.js: Fix byte array unpacking
Recent GJS changed how byte arrays are unpacked with some assumptions
that they are likely strings. Manually use get_child_value() and
get_byte() to ensure the correct value is parsed when checking the
`ostree.sizes` metadata.
The upstream test is currently passing fine with GJS 1.56.2, but at
Endless we (unfortunately) have a downstream change that adds the object
type as an additional byte in the array. This is parsed incorrectly by
`deep_unpack()`. We can carry this patch downstream, but this change
makes the test more robust regardless.
Closes: #1884
Approved by: cgwalters
-rwxr-xr-x | tests/test-sizes.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test-sizes.js b/tests/test-sizes.js index d923e749..73b179c5 100755 --- a/tests/test-sizes.js +++ b/tests/test-sizes.js @@ -64,10 +64,10 @@ assertEquals(nSizes, 2); let expectedUncompressedSizes = [12, 18]; let foundExpectedUncompressedSizes = 0; for (let i = 0; i < nSizes; i++) { - let sizeEntry = sizes.get_child_value(i).deep_unpack(); - assertEquals(sizeEntry.length, 34); - let compressedSize = sizeEntry[32]; - let uncompressedSize = sizeEntry[33]; + let sizeEntry = sizes.get_child_value(i); + assertEquals(sizeEntry.n_children(), 34); + let compressedSize = sizeEntry.get_child_value(32).get_byte(); + let uncompressedSize = sizeEntry.get_child_value(33).get_byte(); print("compressed = " + compressedSize); print("uncompressed = " + uncompressedSize); for (let j = 0; j < expectedUncompressedSizes.length; j++) { |