You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2022/02/21 19:43:50 UTC

[buildstream] 01/01: Revert "Merge pull request #1570 from apache/tristan/test-notparallel"

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

juergbi pushed a commit to branch juerg/ci
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c44b0c3e9ac5c862d0c8151815371640f9118afe
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Mon Feb 21 20:43:21 2022 +0100

    Revert "Merge pull request #1570 from apache/tristan/test-notparallel"
    
    This reverts commit 90cb29f8533ebd119cad7ec7c241649ba8bdaede, reversing
    changes made to d508773169e23754cf9f4140daae903d1755e9e5.
---
 src/buildstream/node.pyx                           |  6 +--
 tests/format/variables.py                          | 51 ----------------------
 tests/format/variables/notparallel/notparallel.bst |  4 --
 tests/format/variables/notparallel/parallel.bst    |  4 --
 .../format/variables/notparallel/plugins/custom.py | 12 -----
 .../variables/notparallel/plugins/custom.yaml      | 10 -----
 tests/format/variables/notparallel/project.conf    | 13 ------
 7 files changed, 3 insertions(+), 97 deletions(-)

diff --git a/src/buildstream/node.pyx b/src/buildstream/node.pyx
index e10c1a2..7d65461 100644
--- a/src/buildstream/node.pyx
+++ b/src/buildstream/node.pyx
@@ -446,7 +446,7 @@ cdef class ScalarNode(Node):
                                        self.get_provenance(),
                                        target_value.get_provenance()))
 
-        target.value[key] = self.clone()
+        target.value[key] = self
 
     cdef bint _is_composite_list(self) except *:
         return False
@@ -973,7 +973,7 @@ cdef class MappingNode(Node):
         if self._is_composite_list():
             if key not in target.value:
                 # Composite list clobbers empty space
-                target.value[key] = self.clone()
+                target.value[key] = self
             else:
                 target_value = target.value[key]
 
@@ -1420,7 +1420,7 @@ cdef class SequenceNode(Node):
             (<SequenceNode> target.value[key]).value.extend(self.value)
         else:
             # Looks good, clobber it
-            target.value[key] = self.clone()
+            target.value[key] = self
 
     cdef bint _is_composite_list(self) except *:
         return False
diff --git a/tests/format/variables.py b/tests/format/variables.py
index 0b30c66..38f3503 100644
--- a/tests/format/variables.py
+++ b/tests/format/variables.py
@@ -243,54 +243,3 @@ def test_partial_context_junctions(cli, datafiles):
     result.assert_success()
     result_vars = _yaml.load_data(result.output)
     assert result_vars.get_str("eltvar") == "/bar/foo/baz"
-
-
-# The notparallel tests use a custom plugin which recreates a situation where
-# a plugin substitutes an environment variable with the protected %{max-jobs}
-# variable, which is set depending on whether the plugin declared notparallel.
-#
-# These are a regression test against issue #1360, where we found variable
-# substitution at the plugin default YAML was buggy when multiple instances
-# were not getting the correct results.
-#
-@pytest.mark.datafiles(os.path.join(DATA_DIR, "notparallel"))
-def test_notparallel(cli, datafiles):
-    project = str(datafiles)
-
-    # Test the vars
-    result = cli.run(project=project, args=["show", "--format", "%{vars}%{env}", "notparallel.bst"])
-    result.assert_success()
-    result_vars = _yaml.load_data(result.output)
-    assert result_vars.get_str("element-name") == "notparallel.bst"
-    assert result_vars.get_str("max-jobs") == "1"
-    assert result_vars.get_str("MAKEFLAGS") == "-j1"
-
-
-@pytest.mark.datafiles(os.path.join(DATA_DIR, "notparallel"))
-def test_notparallel_twice(cli, datafiles):
-    project = str(datafiles)
-
-    #
-    # Explicitly configure default max-jobs using user configuration
-    #
-    cli.configure({"build": {"max-jobs": 2}})
-
-    # Fetch the variables and environment of both elements, where parallel.bst depends on notparallel.bst
-    result = cli.run(project=project, args=["show", "--format", "%{vars}%{env}", "parallel.bst"])
-    result.assert_success()
-
-    # Split on the empty line, which separates elements in bst show output
-    groups = result.output.split("\n\n")
-    assert len(groups) >= 2
-    notparallel_vars = _yaml.load_data(groups[0])
-    parallel_vars = _yaml.load_data(groups[1])
-
-    # Test the first group for the expected notparallel state
-    assert notparallel_vars.get_str("element-name") == "notparallel.bst"
-    assert notparallel_vars.get_str("max-jobs") == "1"
-    assert notparallel_vars.get_str("MAKEFLAGS") == "-j1"
-
-    # Test the second group for the expected !notparallel state
-    assert parallel_vars.get_str("element-name") == "parallel.bst"
-    assert parallel_vars.get_str("max-jobs") == "2"
-    assert parallel_vars.get_str("MAKEFLAGS") == "-j2"
diff --git a/tests/format/variables/notparallel/notparallel.bst b/tests/format/variables/notparallel/notparallel.bst
deleted file mode 100644
index a32c76f..0000000
--- a/tests/format/variables/notparallel/notparallel.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: custom
-
-variables:
-  notparallel: true
diff --git a/tests/format/variables/notparallel/parallel.bst b/tests/format/variables/notparallel/parallel.bst
deleted file mode 100644
index fafe5b3..0000000
--- a/tests/format/variables/notparallel/parallel.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: custom
-
-depends:
-- notparallel.bst
diff --git a/tests/format/variables/notparallel/plugins/custom.py b/tests/format/variables/notparallel/plugins/custom.py
deleted file mode 100644
index 887645a..0000000
--- a/tests/format/variables/notparallel/plugins/custom.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from buildstream import BuildElement
-
-
-# A custom build element
-class CustomElement(BuildElement):
-
-    BST_MIN_VERSION = "2.0"
-
-
-# Plugin entry point
-def setup():
-    return CustomElement
diff --git a/tests/format/variables/notparallel/plugins/custom.yaml b/tests/format/variables/notparallel/plugins/custom.yaml
deleted file mode 100644
index 994678d..0000000
--- a/tests/format/variables/notparallel/plugins/custom.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# This element tests an odd corner case we've discovered with
-# elements which use the `%{max-jobs}` to substitute a nocache
-# environment variable.
-#
-environment:
-  MAKEFLAGS: -j%{max-jobs}
-
-environment-nocache:
-- MAKEFLAGS
diff --git a/tests/format/variables/notparallel/project.conf b/tests/format/variables/notparallel/project.conf
deleted file mode 100644
index 241a4ea..0000000
--- a/tests/format/variables/notparallel/project.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# Basic project configuration that doesnt override anything
-#
-name: zebra
-min-version: 2.0
-
-variables:
-  notparallel: false
-
-plugins:
-- origin: local
-  path: plugins
-  elements:
-  - custom