diff options
-rw-r--r-- | morphlib/artifactresolver_tests.py | 28 | ||||
-rw-r--r-- | morphlib/cachekeycomputer_tests.py | 8 | ||||
-rwxr-xr-x | tests.as-root/system-overlap.script | 4 |
3 files changed, 32 insertions, 8 deletions
diff --git a/morphlib/artifactresolver_tests.py b/morphlib/artifactresolver_tests.py index 467c882d..5dc7f29a 100644 --- a/morphlib/artifactresolver_tests.py +++ b/morphlib/artifactresolver_tests.py @@ -187,10 +187,34 @@ class ArtifactResolverTests(unittest.TestCase): artifacts = self.resolver.resolve_artifacts(pool) self.assertEqual(artifacts[0].source, system) - self.assertEqual(artifacts[0].name, 'foo') + self.assertEqual(artifacts[0].name, 'foo-rootfs') self.assertEqual(artifacts[0].dependencies, []) self.assertEqual(artifacts[0].dependents, []) + def test_resolve_a_single_empty_arm_system(self): + pool = morphlib.sourcepool.SourcePool() + + morph = morphlib.morph2.Morphology( + ''' + { + "name": "foo", + "kind": "system", + "arch": "arm" + } + ''') + system = morphlib.source.Source( + 'repo', 'original/ref', 'sha1', morph, 'foo.morph') + pool.add(system) + + artifacts = self.resolver.resolve_artifacts(pool) + + self.assertTrue(any((a.source == system and a.name == 'foo-rootfs' and + a.dependencies == [] and a.dependents == []) + for a in artifacts)) + self.assertTrue(any((a.source == system and a.name == 'foo-kernel' and + a.dependencies == [] and a.dependents == []) + for a in artifacts)) + def test_resolve_stratum_and_chunk_with_no_subartifacts(self): pool = morphlib.sourcepool.SourcePool() @@ -447,7 +471,7 @@ class ArtifactResolverTests(unittest.TestCase): self.assertEqual(artifacts[0].dependents, [artifacts[1], artifacts[2]]) self.assertEqual(artifacts[1].source, system) - self.assertEqual(artifacts[1].name, 'system') + self.assertEqual(artifacts[1].name, 'system-rootfs') self.assertEqual(artifacts[1].dependencies, [artifacts[0], artifacts[2]]) self.assertEqual(artifacts[1].dependents, []) diff --git a/morphlib/cachekeycomputer_tests.py b/morphlib/cachekeycomputer_tests.py index 807fbe89..82d3e6e5 100644 --- a/morphlib/cachekeycomputer_tests.py +++ b/morphlib/cachekeycomputer_tests.py @@ -117,7 +117,7 @@ class CacheKeyComputerTests(unittest.TestCase): self.ckc._hash_list = inccount(self.ckc._hash_list, 'list') self.ckc._hash_tuple = inccount(self.ckc._hash_tuple, 'tuple') - artifact = self._find_artifact('system') + artifact = self._find_artifact('system-rootfs') self.ckc.compute_key(artifact) self.assertNotEqual(runcount['thing'], 0) @@ -130,12 +130,12 @@ class CacheKeyComputerTests(unittest.TestCase): return len(s) == 64 and all([c in validchars for c in s]) def test_compute_key_returns_sha256(self): - artifact = self._find_artifact('system') + artifact = self._find_artifact('system-rootfs') self.assertTrue(self._valid_sha256( self.ckc.compute_key(artifact))) def test_different_env_gives_different_key(self): - artifact = self._find_artifact('system') + artifact = self._find_artifact('system-rootfs') oldsha = self.ckc.compute_key(artifact) build_env = DummyBuildEnvironment({ "USER": "foouser", @@ -150,7 +150,7 @@ class CacheKeyComputerTests(unittest.TestCase): self.assertNotEqual(oldsha, ckc.compute_key(artifact)) def test_same_morphology_text_but_changed_sha1_gives_same_cache_key(self): - old_artifact = self._find_artifact('system') + old_artifact = self._find_artifact('system-rootfs') morphology = old_artifact.source.morphology new_source = morphlib.source.Source('repo', 'original/ref', 'newsha', morphology, diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script index 60ae9a8a..7673ca74 100755 --- a/tests.as-root/system-overlap.script +++ b/tests.as-root/system-overlap.script @@ -136,9 +136,9 @@ git commit --quiet -m 'Add overlapping chunks' "$SRCDIR/scripts/test-morph" \ build test:morphs-repo overlap overlap-system.morph > /dev/null "$SRCDIR/scripts/list-overlaps" groups \ - "$cache"/*.system.overlap-system.overlaps | + "$cache"/*.system.overlap-system*.overlaps | while IFS='\n' read overlaps; do echo $overlaps "$SRCDIR/scripts/list-overlaps" list-files \ - "$cache"/*.system.overlap-system.overlaps $overlaps + "$cache"/*.system.overlap-system*.overlaps $overlaps done |