# HG changeset patch # User Raphaël Gomès <rgomes@octobus.net> # Date 1564692831 -7200 # Thu Aug 01 22:53:51 2019 +0200 # Node ID 61d17b63e5d5fbabdf76e3ec271f0f9310f0b478 # Parent bc2e9db301a8bf5cade69989e7fd2cc527e26ba2 rust-policy: skip if current revision is an ancestor of the rust module policy We can't make sure that no Rust code will be run before the rust module policy was introduced in 94167e701e125dce1788e19b1e1489958235e40c, in fact, we can be pretty sure of it. diff --git a/benchmarks/utils.py b/benchmarks/utils.py --- a/benchmarks/utils.py +++ b/benchmarks/utils.py @@ -324,6 +324,29 @@ # define the cache dir for simplicity self._cache_dir = os.getcwd() + # Don't run if using Rust on a revision before the Rust modulepolicy + # was introduced + if os.environ.get("HGMODULEPOLICY").startswith("rust"): + # Don't use `subprocess.PIPE` as it can deadlock (see docs). + # We capture `stderr` because the error message from `hg log` would + # make it seem like there was a bug. + with open(os.devnull, "w") as FNULL: + try: + self.hg( + "log", + "-r", + "94167e701e125dce1788e19b1e1489958235e40c", + stderr=FNULL, + ) + except subprocess.CalledProcessError as e: + if e.returncode == 255: + raise NotImplementedError( + "Rust modulepolicy was not implemented before " + "revision 94167e701e125dce1788e19b1e1489958235e40c" + ", skipping." + ) + raise + def should_skip_benchmark(self, incompatibility_revset, current_version, filter_fn, test_kwargs): """Determines whether the benchmark should be run given an exclusion revset, the current mercurial version and an optional filter function.