You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:31:26 UTC

[buildstream] branch jmac/vdir_import_test created (now 3dcc81b)

This is an automated email from the ASF dual-hosted git repository.

root pushed a change to branch jmac/vdir_import_test
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 3dcc81b  virtual_directory_import.py: Test direct import of randomly generated directory

This branch includes the following new commits:

     new 3dcc81b  virtual_directory_import.py: Test direct import of randomly generated directory

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/01: virtual_directory_import.py: Test direct import of randomly generated directory

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch jmac/vdir_import_test
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 3dcc81bbe4b5c59ce66e210ff14381a0088b15f7
Author: Jim MacArthur <ji...@codethink.co.uk>
AuthorDate: Thu Oct 11 15:33:48 2018 +0100

    virtual_directory_import.py: Test direct import of randomly generated directory
---
 tests/storage/virtual_directory_import.py | 44 ++++++++++++++++---------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/tests/storage/virtual_directory_import.py b/tests/storage/virtual_directory_import.py
index 1c78c1b..b383aff 100644
--- a/tests/storage/virtual_directory_import.py
+++ b/tests/storage/virtual_directory_import.py
@@ -141,7 +141,7 @@ def directory_not_empty(path):
     return os.listdir(path)
 
 
-@pytest.mark.parametrize("original,overlay", combinations([1, 2, 3, 4, 5]))
+@pytest.mark.parametrize("original,overlay", combinations([1, 2, 3, 4, 5, 6]))
 def test_cas_import(cli, tmpdir, original, overlay):
     fake_context = FakeContext()
     fake_context.artifactdir = tmpdir
@@ -153,26 +153,28 @@ def test_cas_import(cli, tmpdir, original, overlay):
     d.import_files(d2)
     d.export_files(os.path.join(tmpdir, "output"))
 
-    for item in root_filesets[overlay - 1]:
-        (path, typename, content) = item
-        realpath = resolve_symlinks(path, os.path.join(tmpdir, "output"))
-        if typename == 'F':
-            if os.path.isdir(realpath) and directory_not_empty(realpath):
-                # The file should not have overwritten the directory in this case.
-                pass
-            else:
-                assert os.path.isfile(realpath), "{} did not exist in the combined virtual directory".format(path)
-                assert file_contents_are(realpath, content)
-        elif typename == 'S':
-            if os.path.isdir(realpath) and directory_not_empty(realpath):
-                # The symlink should not have overwritten the directory in this case.
-                pass
-            else:
-                assert os.path.islink(realpath)
-                assert os.readlink(realpath) == content
-        elif typename == 'D':
-            # Note that isdir accepts symlinks to dirs, so a symlink to a dir is acceptable.
-            assert os.path.isdir(realpath)
+    if overlay < 6:
+        # TODO: We don't do a detailed content check for root 6, the random one
+        for item in root_filesets[overlay - 1]:
+            (path, typename, content) = item
+            realpath = resolve_symlinks(path, os.path.join(tmpdir, "output"))
+            if typename == 'F':
+                if os.path.isdir(realpath) and directory_not_empty(realpath):
+                    # The file should not have overwritten the directory in this case.
+                    pass
+                else:
+                    assert os.path.isfile(realpath), "{} did not exist in the combined virtual directory".format(path)
+                    assert file_contents_are(realpath, content)
+            elif typename == 'S':
+                if os.path.isdir(realpath) and directory_not_empty(realpath):
+                    # The symlink should not have overwritten the directory in this case.
+                    pass
+                else:
+                    assert os.path.islink(realpath)
+                    assert os.readlink(realpath) == content
+            elif typename == 'D':
+                # Note that isdir accepts symlinks to dirs, so a symlink to a dir is acceptable.
+                assert os.path.isdir(realpath)
 
     # Now do the same thing with filebaseddirectories and check the contents match
     d3 = create_new_casdir(original, fake_context, tmpdir)