diff options
author | Jürg Billeter <j@bitron.ch> | 2020-04-07 16:07:06 +0200 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-04-08 06:57:57 +0000 |
commit | 35cccea151f4fac5ba982653f6408b0b267a3f57 (patch) | |
tree | 520570ac1d9f7c2bbd97220d5e3eed3eadf817c4 | |
parent | c6b644653f83e7ff4d357c08ae97e0cd3306a9bd (diff) | |
download | buildstream-juerg/export-to-tar.tar.gz |
tests/frontend/buildcheckout.py: Check mode and uid/gid in tarballjuerg/export-to-tar
-rw-r--r-- | tests/frontend/buildcheckout.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index 512c6c151..52cf031ad 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -254,6 +254,9 @@ def test_build_checkout_tarball(datafiles, cli): project = str(datafiles) checkout = os.path.join(cli.directory, "checkout.tar") + # Work-around datafiles not preserving mode + os.chmod(os.path.join(project, "files/bin-files/usr/bin/hello"), 0o0755) + result = cli.run(project=project, args=["build", "target.bst"]) result.assert_success() @@ -267,8 +270,16 @@ def test_build_checkout_tarball(datafiles, cli): result.assert_success() tar = tarfile.TarFile(checkout) - assert os.path.join(".", "usr", "bin", "hello") in tar.getnames() - assert os.path.join(".", "usr", "include", "pony.h") in tar.getnames() + + tarinfo = tar.getmember(os.path.join(".", "usr", "bin", "hello")) + assert tarinfo.mode == 0o755 + assert tarinfo.uid == 0 and tarinfo.gid == 0 + assert tarinfo.uname == "" and tarinfo.gname == "" + + tarinfo = tar.getmember(os.path.join(".", "usr", "include", "pony.h")) + assert tarinfo.mode == 0o644 + assert tarinfo.uid == 0 and tarinfo.gid == 0 + assert tarinfo.uname == "" and tarinfo.gname == "" @pytest.mark.datafiles(DATA_DIR) |