summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-10-08 16:31:56 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-10-08 16:35:46 +0200
commit9956e8369abf6e4735a78e30a78d010e562bea9d (patch)
tree46f6ade7cce5b34689f4d115e78452da4a7881ef /test
parent8798a8bdf82c87a136c07410d65267859f92e851 (diff)
downloadjustbuild-9956e8369abf6e4735a78e30a78d010e562bea9d.tar.gz
tests: use --dump-plain-graph to simplify equality check
Diffstat (limited to 'test')
-rw-r--r--test/end-to-end/git-import/TARGETS8
-rwxr-xr-xtest/end-to-end/git-import/check-action-equality.py37
-rwxr-xr-xtest/end-to-end/git-import/deduplicate.sh7
3 files changed, 4 insertions, 48 deletions
diff --git a/test/end-to-end/git-import/TARGETS b/test/end-to-end/git-import/TARGETS
index 4ff3ff03..afd79db2 100644
--- a/test/end-to-end/git-import/TARGETS
+++ b/test/end-to-end/git-import/TARGETS
@@ -8,18 +8,12 @@
, ["end-to-end", "git-import-under-test"]
]
}
-, "check-action-equality":
- { "type": "install"
- , "tainted": ["test"]
- , "files": {"bin/actions-graph-equal": "check-action-equality.py"}
- }
, "deduplicate":
{ "type": ["@", "rules", "shell/test", "script"]
, "name": ["deduplicate"]
, "test": ["deduplicate.sh"]
, "deps":
- [ "check-action-equality"
- , ["", "mr-tool-under-test"]
+ [ ["", "mr-tool-under-test"]
, ["", "tool-under-test"]
, ["end-to-end", "deduplicate-tool-under-test"]
, ["end-to-end", "git-import-under-test"]
diff --git a/test/end-to-end/git-import/check-action-equality.py b/test/end-to-end/git-import/check-action-equality.py
deleted file mode 100755
index ab82798e..00000000
--- a/test/end-to-end/git-import/check-action-equality.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2023 Huawei Cloud Computing Technology Co., Ltd.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import json
-import sys
-
-from typing import Any
-
-Json = Any
-
-def normalize(a: Json):
- for n in a["actions"].keys():
- del a["actions"][n]["origins"]
-
-if __name__ == "__main__":
- with open(sys.argv[1]) as f:
- a: Json = json.load(f)
- with open(sys.argv[2]) as f:
- b: Json = json.load(f)
- normalize(a)
- normalize(b)
- if a != b:
- print("The action graphs in %s and %s differ!"
- % (sys.argv[1], sys.argv[2]))
- sys.exit(1)
diff --git a/test/end-to-end/git-import/deduplicate.sh b/test/end-to-end/git-import/deduplicate.sh
index dce77fbe..ec7e614c 100755
--- a/test/end-to-end/git-import/deduplicate.sh
+++ b/test/end-to-end/git-import/deduplicate.sh
@@ -20,7 +20,6 @@ readonly DEDUPLICATE="${PWD}/bin/deduplicate-tool-under-test"
readonly GIT_IMPORT="${PWD}/bin/git-import-under-test"
readonly JUST="${PWD}/bin/tool-under-test"
readonly JUST_MR="${PWD}/bin/mr-tool-under-test"
-readonly ACTIONS_EQUAL="${PWD}/bin/actions-graph-equal"
readonly LBR="${TEST_TMPDIR}/local-build-root"
readonly OUT="${TEST_TMPDIR}/build-output"
readonly REPO_DIRS="${TEST_TMPDIR}/repos"
@@ -102,7 +101,7 @@ cat repos-full.json
echo
"${JUST_MR}" -C repos-full.json --norc --just "${JUST}" \
--local-build-root "${LBR}" analyse \
- --dump-graph actions-full.json 2>&1
+ --dump-plain-graph actions-full.json 2>&1
echo
cat repos-full.json | "${DEDUPLICATE}" > repos.json
cat repos.json
@@ -110,11 +109,11 @@ echo
"${JUST_MR}" -C repos.json --norc --just "${JUST}" \
--local-build-root "${LBR}" analyse \
- --dump-graph actions.json 2>&1
+ --dump-plain-graph actions.json 2>&1
# Verify that we reduced the number of repositories, but did
# not change the action graph (except for the origins of the actions).
[ $(jq -aM '.repositories | length' repos.json) -lt $(jq -aM '.repositories | length' repos-full.json) ]
-"${ACTIONS_EQUAL}" actions-full.json actions.json
+cmp actions-full.json actions.json
echo "OK"