summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/cachekey/cachekey.py38
-rw-r--r--tests/cachekey/project/elements/key-stability/aaa.bst4
-rw-r--r--tests/cachekey/project/elements/key-stability/t1.bst6
-rw-r--r--tests/cachekey/project/elements/key-stability/t2.bst7
-rw-r--r--tests/cachekey/project/elements/key-stability/top-level.bst7
-rw-r--r--tests/cachekey/project/elements/key-stability/zzz.bst4
6 files changed, 66 insertions, 0 deletions
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py
index c278b9ca9..761ff0c76 100644
--- a/tests/cachekey/cachekey.py
+++ b/tests/cachekey/cachekey.py
@@ -214,3 +214,41 @@ def test_cache_key_fatal_warnings(cli, tmpdir, first_warnings, second_warnings,
second_keys = run_get_cache_key("second", second_warnings)
assert compare_cache_keys(first_keys, second_keys) == identical_keys
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_keys_stable_over_targets(cli, datafiles):
+ root_element = 'elements/key-stability/top-level.bst'
+ target1 = 'elements/key-stability/t1.bst'
+ target2 = 'elements/key-stability/t2.bst'
+
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ full_graph_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ root_element
+ ])
+ full_graph_result.assert_success()
+ all_cache_keys = parse_output_keys(full_graph_result.output)
+
+ ordering1_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ target1,
+ target2
+ ])
+ ordering1_result.assert_success()
+ ordering1_cache_keys = parse_output_keys(ordering1_result.output)
+
+ ordering2_result = cli.run(project=project, args=[
+ 'show',
+ '--format', '%{name}::%{full-key}',
+ target2,
+ target1
+ ])
+ ordering2_result.assert_success()
+ ordering2_cache_keys = parse_output_keys(ordering2_result.output)
+
+ for element in ordering1_cache_keys:
+ assert ordering1_cache_keys[element] == ordering2_cache_keys[element]
+ assert ordering1_cache_keys[element] == all_cache_keys[element]
diff --git a/tests/cachekey/project/elements/key-stability/aaa.bst b/tests/cachekey/project/elements/key-stability/aaa.bst
new file mode 100644
index 000000000..cecbc2730
--- /dev/null
+++ b/tests/cachekey/project/elements/key-stability/aaa.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: elements/key-stability/aaa.bst
diff --git a/tests/cachekey/project/elements/key-stability/t1.bst b/tests/cachekey/project/elements/key-stability/t1.bst
new file mode 100644
index 000000000..1ec009cf1
--- /dev/null
+++ b/tests/cachekey/project/elements/key-stability/t1.bst
@@ -0,0 +1,6 @@
+kind: import
+sources:
+- kind: local
+ path: elements/key-stability/t1.bst
+depends:
+- elements/key-stability/zzz.bst
diff --git a/tests/cachekey/project/elements/key-stability/t2.bst b/tests/cachekey/project/elements/key-stability/t2.bst
new file mode 100644
index 000000000..66f729373
--- /dev/null
+++ b/tests/cachekey/project/elements/key-stability/t2.bst
@@ -0,0 +1,7 @@
+kind: import
+sources:
+- kind: local
+ path: elements/key-stability/t2.bst
+depends:
+- elements/key-stability/aaa.bst
+- elements/key-stability/zzz.bst
diff --git a/tests/cachekey/project/elements/key-stability/top-level.bst b/tests/cachekey/project/elements/key-stability/top-level.bst
new file mode 100644
index 000000000..68d8a0e4d
--- /dev/null
+++ b/tests/cachekey/project/elements/key-stability/top-level.bst
@@ -0,0 +1,7 @@
+kind: import
+sources:
+- kind: local
+ path: elements/key-stability/top-level.bst
+depends:
+- elements/key-stability/t1.bst
+- elements/key-stability/t2.bst
diff --git a/tests/cachekey/project/elements/key-stability/zzz.bst b/tests/cachekey/project/elements/key-stability/zzz.bst
new file mode 100644
index 000000000..7ff782006
--- /dev/null
+++ b/tests/cachekey/project/elements/key-stability/zzz.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: elements/key-stability/zzz.bst