Phil Dawson pushed to branch phil/cache-key-stability-test at BuildStream / buildstream
Commits:
- 
664e1b81
by Phil Dawson at 2019-02-01T14:24:50Z
 
6 changed files:
- tests/cachekey/cachekey.py
 - + tests/cachekey/project/elements/key-stability/aaa.bst
 - + tests/cachekey/project/elements/key-stability/t1.bst
 - + tests/cachekey/project/elements/key-stability/t2.bst
 - + tests/cachekey/project/elements/key-stability/top-level.bst
 - + tests/cachekey/project/elements/key-stability/zzz.bst
 
Changes:
| ... | ... | @@ -214,3 +214,41 @@ def test_cache_key_fatal_warnings(cli, tmpdir, first_warnings, second_warnings, | 
| 214 | 214 | 
     second_keys = run_get_cache_key("second", second_warnings)
 | 
| 215 | 215 | 
 | 
| 216 | 216 | 
     assert compare_cache_keys(first_keys, second_keys) == identical_keys
 | 
| 217 | 
+  | 
|
| 218 | 
+  | 
|
| 219 | 
+@pytest.mark.datafiles(DATA_DIR)
 | 
|
| 220 | 
+def test_keys_stable_over_targets(cli, datafiles):
 | 
|
| 221 | 
+    root_element = 'elements/key-stability/top-level.bst'
 | 
|
| 222 | 
+    target1 = 'elements/key-stability/t1.bst'
 | 
|
| 223 | 
+    target2 = 'elements/key-stability/t2.bst'
 | 
|
| 224 | 
+  | 
|
| 225 | 
+    project = os.path.join(datafiles.dirname, datafiles.basename)
 | 
|
| 226 | 
+    full_graph_result = cli.run(project=project, args=[
 | 
|
| 227 | 
+        'show',
 | 
|
| 228 | 
+        '--format', '%{name}::%{full-key}',
 | 
|
| 229 | 
+        root_element
 | 
|
| 230 | 
+    ])
 | 
|
| 231 | 
+    full_graph_result.assert_success()
 | 
|
| 232 | 
+    all_cache_keys = parse_output_keys(full_graph_result.output)
 | 
|
| 233 | 
+  | 
|
| 234 | 
+    ordering1_result = cli.run(project=project, args=[
 | 
|
| 235 | 
+        'show',
 | 
|
| 236 | 
+        '--format', '%{name}::%{full-key}',
 | 
|
| 237 | 
+        target1,
 | 
|
| 238 | 
+        target2
 | 
|
| 239 | 
+    ])
 | 
|
| 240 | 
+    ordering1_result.assert_success()
 | 
|
| 241 | 
+    ordering1_cache_keys = parse_output_keys(ordering1_result.output)
 | 
|
| 242 | 
+  | 
|
| 243 | 
+    ordering2_result = cli.run(project=project, args=[
 | 
|
| 244 | 
+        'show',
 | 
|
| 245 | 
+        '--format', '%{name}::%{full-key}',
 | 
|
| 246 | 
+        target2,
 | 
|
| 247 | 
+        target1
 | 
|
| 248 | 
+    ])
 | 
|
| 249 | 
+    ordering2_result.assert_success()
 | 
|
| 250 | 
+    ordering2_cache_keys = parse_output_keys(ordering2_result.output)
 | 
|
| 251 | 
+  | 
|
| 252 | 
+    for element in ordering1_cache_keys:
 | 
|
| 253 | 
+        assert ordering1_cache_keys[element] == ordering2_cache_keys[element]
 | 
|
| 254 | 
+        assert ordering1_cache_keys[element] == all_cache_keys[element]
 | 
| 1 | 
+kind: import
 | 
|
| 2 | 
+sources:
 | 
|
| 3 | 
+- kind: local
 | 
|
| 4 | 
+  path: elements/key-stability/aaa.bst
 | 
| 1 | 
+kind: import
 | 
|
| 2 | 
+sources:
 | 
|
| 3 | 
+- kind: local
 | 
|
| 4 | 
+  path: elements/key-stability/t1.bst
 | 
|
| 5 | 
+depends:
 | 
|
| 6 | 
+- elements/key-stability/zzz.bst
 | 
| 1 | 
+kind: import
 | 
|
| 2 | 
+sources:
 | 
|
| 3 | 
+- kind: local
 | 
|
| 4 | 
+  path: elements/key-stability/t2.bst
 | 
|
| 5 | 
+depends:
 | 
|
| 6 | 
+- elements/key-stability/aaa.bst
 | 
|
| 7 | 
+- elements/key-stability/zzz.bst
 | 
| 1 | 
+kind: import
 | 
|
| 2 | 
+sources:
 | 
|
| 3 | 
+- kind: local
 | 
|
| 4 | 
+  path: elements/key-stability/top-level.bst
 | 
|
| 5 | 
+depends:
 | 
|
| 6 | 
+- elements/key-stability/t1.bst
 | 
|
| 7 | 
+- elements/key-stability/t2.bst
 | 
| 1 | 
+kind: import
 | 
|
| 2 | 
+sources:
 | 
|
| 3 | 
+- kind: local
 | 
|
| 4 | 
+  path: elements/key-stability/zzz.bst
 | 
