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

[buildstream] branch nanonyme/fix-tests created (now de613d3)

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

not-in-ldap pushed a change to branch nanonyme/fix-tests
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at de613d3  Conditionally skip failing test

This branch includes the following new commits:

     new 5019673  Adding have_subsecond_mtime() Backport of d164ae319fced1e41ce5978a90c2bd64983cb54e
     new de613d3  Conditionally skip failing test

The 2 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/02: Adding have_subsecond_mtime() Backport of d164ae319fced1e41ce5978a90c2bd64983cb54e

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

not-in-ldap pushed a commit to branch nanonyme/fix-tests
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5019673d1d7eea79d44f9e906e88943f7f5367d5
Author: Seppo Yli-Olli <se...@gmail.com>
AuthorDate: Mon Nov 2 17:46:39 2020 +0200

    Adding have_subsecond_mtime()
    Backport of d164ae319fced1e41ce5978a90c2bd64983cb54e
---
 tests/testutils/site.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/testutils/site.py b/tests/testutils/site.py
index 7dc01a6..bf3ae8d 100644
--- a/tests/testutils/site.py
+++ b/tests/testutils/site.py
@@ -3,6 +3,7 @@
 #
 import os
 import sys
+import tempfile
 
 from buildstream import utils, ProgramNotFoundError
 
@@ -49,3 +50,34 @@ except ImportError:
     HAVE_ARPY = False
 
 IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux')
+
+
+# Check if we have subsecond mtime support on the
+# filesystem where @directory is located.
+#
+def have_subsecond_mtime(directory):
+
+    try:
+        test_file, test_filename = tempfile.mkstemp(dir=directory)
+        os.close(test_file)
+    except OSError:
+        # If we can't create a temp file, lets just say this is False
+        return False
+
+    try:
+        os.utime(test_filename, times=None, ns=(int(12345), int(12345)))
+    except OSError:
+        # If we can't set the mtime, lets just say this is False
+        os.unlink(test_filename)
+        return False
+
+    try:
+        stat_result = os.stat(test_filename)
+    except OSError:
+        # If we can't stat the file, lets just say this is False
+        os.unlink(test_filename)
+        return False
+
+    os.unlink(test_filename)
+
+    return stat_result.st_mtime_ns == 12345


[buildstream] 02/02: Conditionally skip failing test

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

not-in-ldap pushed a commit to branch nanonyme/fix-tests
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit de613d3ac45e08967ff2e8db498137fa0c33eec6
Author: Seppo Yli-Olli <se...@gmail.com>
AuthorDate: Mon Nov 2 17:51:18 2020 +0200

    Conditionally skip failing test
---
 tests/frontend/workspace.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index aff3e15..67a35ab 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -3,7 +3,7 @@ import pytest
 import shutil
 import subprocess
 from ruamel.yaml.comments import CommentedSet
-from tests.testutils import cli, create_repo, ALL_REPO_KINDS
+from tests.testutils import cli, create_repo, ALL_REPO_KINDS, site
 
 from buildstream import _yaml
 from buildstream._exceptions import ErrorDomain, LoadError, LoadErrorReason
@@ -517,6 +517,9 @@ def test_detect_modifications(cli, tmpdir, datafiles, modification, strict):
     elif modification == 'removefile':
         os.remove(os.path.join(workspace, 'usr', 'bin', 'hello'))
     elif modification == 'modifyfile':
+        if not site.have_subsecond_mtime(tmpdir):
+            pytest.skip("Filesystem does not support subsecond mtime precision: {}".format(tmpdir))
+
         with open(os.path.join(workspace, 'usr', 'bin', 'hello'), 'w') as f:
             f.write('cookie')
     else: