tests/archive: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:49:50 -05:00
1 parent 54f53a35f6
commit 96602286f8
33 files changed
+34 -226

No files matched your search

+1 -11
View File
@@ -1,8 +1,4 @@
-- archive/cpio tests (and containers/Cpio): GNU cpio archives of one tree in newc / crc / odc / bin (and the bin one
-- byte-swapped to big endian) and bsdtar newc / odc archives list the entries os.lstat sees (names, types, modes, sizes,
-- mtimes, link counts, symlink targets, data CRCs, hard links reading the shared data); re-encoding the GNU newc / crc /
-- odc archives gives GNU's bytes; devices (rdev fields), crc sums, a .cpio.gz through the api, conversions to and from
-- tar (hard links share an inode), errors, the fuzz pass. Fixtures: tools/fixtures/cpio.py.
-- archive/cpio tests (and containers/Cpio) against GNU cpio and bsdtar (tools/fixtures/cpio.py).
local T = require("@tests/T")
local F = require("@rosetta")
local CpioF = require("@rosetta/archive/cpio")
@@ -42,7 +38,6 @@ local function check(a: any, want: any, label: string)
end
end
-- 1. reading
for _, c in Fx.archives do
local a, err = CpioF.decode(Bytes.reader(buffer.fromstring(c.data)))
t:check(a, c.name .. ": " .. tostring(err))
@@ -61,7 +56,6 @@ for _, c in Fx.archives do
end
end
-- 2. writing: GNU's bytes back from the decoded archive (newc / crc / odc)
for _, c in Fx.archives do
if c.gnu and c.format ~= "bin" then
local a = CpioF.decode(Bytes.reader(buffer.fromstring(c.data)))
@@ -71,7 +65,6 @@ for _, c in Fx.archives do
end
end
-- 3. devices, sums, the container directly
do
local list, info = Cpio.read(buffer.fromstring(Fx.devices))
t:check(list and info.format == "newc", "devices: read")
@@ -84,7 +77,6 @@ do
local _, e1 = Cpio.read(buffer.fromstring(Fx.badcrc))
t:check(e1 and e1.code == Err.CHECKSUM, "crc: bad sum: " .. tostring(e1))
t:check(Cpio.read(buffer.fromstring(Fx.badcrc), 0, nil, { verify = false }), "crc: verify = false")
-- devices survive a newc and an odc write
for _, fmt in { "newc", "odc" } do
local a = CpioF.decode(Bytes.reader(buffer.fromstring(Fx.devices)))
local back = CpioF.decode(Bytes.reader(assert(a:write({ format = fmt }))))
@@ -93,7 +85,6 @@ do
end
end
-- 4. the api: .cpio.gz unwraps, Archive values, conversions
do
local a, err = F.load(Fx.gz, { name = "tree.cpio.gz" })
t:check(a and a.format == "cpio" and a.meta.compression == "gzip", "cpio.gz unwraps: " .. tostring(err))
@@ -125,7 +116,6 @@ do
t:eq(cp:list()[1].nlink, 2, "tar hard link -> cpio: nlink")
end
-- 5. errors
do
local good = Fx.archives[1].data
local _, e1 = CpioF.decode(Bytes.reader(buffer.fromstring(string.sub(good, 1, 300))))