summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-12-05 19:44:54 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-12-05 20:24:08 +0100
commit5baa020e99e958a57a5986624b4241833c8823e3 (patch)
treed3557143e1ddcf59d0520b0dd27de7d161a99c05 /test
parentf8dbe63a58b4cd96dfdf0ae53c90a33e25432bf8 (diff)
Test: repo checkouts with subtreeHEADmaster
Diffstat (limited to 'test')
-rw-r--r--test/asset/repo/checkout.yaml93
-rw-r--r--test/script/repo.et176
2 files changed, 269 insertions, 0 deletions
diff --git a/test/asset/repo/checkout.yaml b/test/asset/repo/checkout.yaml
new file mode 100644
index 0000000..f1bcbc8
--- /dev/null
+++ b/test/asset/repo/checkout.yaml
@@ -0,0 +1,93 @@
+repo r1:
+repo r2:
+repo r3:
+
+job checkout_subtree:
+ checkout:
+ - repo: r1
+ dest: d1
+
+ - repo: r2
+ subtree: s1
+ dest: d2_s1
+
+ shell:
+ - find \! -name 'list?' -type f > list1
+
+ artifact out:
+ path: list1
+
+
+job checkout_common_root:
+ checkout:
+ - repo: r1
+ dest: d1
+
+ - repo: r2
+ subtree: s1
+ dest: d2_s1
+
+ - repo: r2
+ subtree: s2
+ dest: d2_s2
+
+ shell:
+ - find \! -name 'list?' -type f > list2
+
+ artifact out:
+ path: list2
+
+
+job checkout_common_subtree:
+ checkout:
+ - repo: r3
+ subtree: a/b/s1
+ dest: d3_s1
+
+ - repo: r3
+ subtree: a/b/c/s2
+ dest: d3_s2
+
+ shell:
+ - find \! -name 'list?' -type f > list3
+
+ artifact out:
+ path: list3
+
+
+job checkout_common_subtree2:
+ checkout:
+ - repo: r1
+ dest: d1
+
+ - repo: r2
+ subtree: s1
+ dest: d2_s1
+
+ - repo: r3
+ subtree: a/b/c/s2
+ dest: d3_s2
+
+ - repo: r3
+ subtree: a/b/c/s3
+ dest: d3_s3
+
+ shell:
+ - find \! -name 'list?' -type f > list4
+
+ artifact out:
+ path: list4
+
+
+job combined_subtree:
+ uses:
+ - checkout_common_root.out
+ - checkout_common_subtree2.out
+
+
+job combined_all:
+ uses:
+ - checkout_subtree.out
+ - checkout_common_root.out
+ - checkout_common_subtree.out
+ - checkout_common_subtree2.out
diff --git a/test/script/repo.et b/test/script/repo.et
index d93f700..aeeeb6a 100644
--- a/test/script/repo.et
+++ b/test/script/repo.et
@@ -1,3 +1,11 @@
+module repo
+
+import common
+
+asset scripts:
+ path: ../asset/repo
+
+
test RepoSubtree:
node n
shell on n as git_init:
@@ -87,3 +95,171 @@ test RepoSubtree:
expect from p /msg $sub2/
expect from p /path (.*)/ capture path
guard (path == "first/second")
+
+
+test CheckoutSubtree:
+ node n
+ shell on n as git_init:
+ mkdir -p main
+ git -C main -c init.defaultBranch=master init -q
+ cp "${scripts.path}/checkout.yaml" main/minici.yaml
+ git -C main add minici.yaml
+ git -C main -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
+ git -C main rev-parse HEAD
+ git -C main rev-parse HEAD^{tree}
+
+ mkdir -p dir_r1
+ git -C dir_r1 -c init.defaultBranch=master init -q
+ git -C dir_r1 -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
+ touch dir_r1/file
+ git -C dir_r1 add .
+ git -C dir_r1 -c user.name=test -c user.email=test commit -q --allow-empty -m 'commit r1'
+ git -C dir_r1 rev-parse HEAD
+ git -C dir_r1 rev-parse HEAD^{tree}
+
+ mkdir -p dir_r2
+ git -C dir_r2 -c init.defaultBranch=master init -q
+ git -C dir_r2 -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
+ mkdir -p dir_r2/s1
+ mkdir -p dir_r2/s2
+ touch dir_r2/s1/file1
+ touch dir_r2/s2/file2
+ git -C dir_r2 add .
+ git -C dir_r2 -c user.name=test -c user.email=test commit -q --allow-empty -m 'commit r2'
+ git -C dir_r2 rev-parse HEAD
+ git -C dir_r2 rev-parse HEAD^{tree}
+ git -C dir_r2 rev-parse HEAD^{tree}:s1
+ git -C dir_r2 rev-parse HEAD^{tree}:s2
+
+ mkdir -p dir_r3
+ git -C dir_r3 -c init.defaultBranch=master init -q
+ git -C dir_r3 -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
+ mkdir -p dir_r3/a/b/s1
+ mkdir -p dir_r3/a/b/c/s2
+ mkdir -p dir_r3/a/b/c/s3
+ touch dir_r3/a/b/s1/file1
+ touch dir_r3/a/b/c/s2/file2
+ touch dir_r3/a/b/c/s3/file3
+ git -C dir_r3 add .
+ git -C dir_r3 -c user.name=test -c user.email=test commit -q --allow-empty -m 'commit r3'
+ git -C dir_r3 rev-parse HEAD
+ git -C dir_r3 rev-parse HEAD^{tree}
+ git -C dir_r3 rev-parse HEAD^{tree}:a/b
+ git -C dir_r3 rev-parse HEAD^{tree}:a/b/s1
+ git -C dir_r3 rev-parse HEAD^{tree}:a/b/c
+ git -C dir_r3 rev-parse HEAD^{tree}:a/b/c/s2
+ git -C dir_r3 rev-parse HEAD^{tree}:a/b/c/s3
+
+ expect /([0-9a-f]+)/ from git_init capture mc
+ expect /([0-9a-f]+)/ from git_init capture mt
+
+ expect /([0-9a-f]+)/ from git_init capture r1c
+ expect /([0-9a-f]+)/ from git_init capture r1t
+
+ expect /([0-9a-f]+)/ from git_init capture r2c
+ expect /([0-9a-f]+)/ from git_init capture r2t
+ expect /([0-9a-f]+)/ from git_init capture r2s1
+ expect /([0-9a-f]+)/ from git_init capture r2s2
+
+ expect /([0-9a-f]+)/ from git_init capture r3c
+ expect /([0-9a-f]+)/ from git_init capture r3t
+ expect /([0-9a-f]+)/ from git_init capture r3ab
+ expect /([0-9a-f]+)/ from git_init capture r3abs1
+ expect /([0-9a-f]+)/ from git_init capture r3abc
+ expect /([0-9a-f]+)/ from git_init capture r3abcs2
+ expect /([0-9a-f]+)/ from git_init capture r3abcs3
+
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "checkout_subtree" ]
+ expect_success from p of "$mt.checkout_subtree.$r1t.$r2s1"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "$mt.checkout_subtree.$r1t.$r2s1" ]
+ expect_success from p of "$mt.checkout_subtree.$r1t.$r2s1"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "extract", "$mt.checkout_subtree.$r1t.$r2s1.out", "list" ]
+ local:
+ shell on n as list:
+ cat list
+ rm list
+ echo DONE
+ expect from list:
+ /\.\/d1\/file/
+ /\.\/d2_s1\/file1/
+ /(.*)/ capture done
+ guard (done == "DONE")
+
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "checkout_common_root" ]
+ expect_success from p of "$mt.checkout_common_root.$r1t.$r2t"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "$mt.checkout_common_root.$r1t.$r2t" ]
+ expect_success from p of "$mt.checkout_common_root.$r1t.$r2t"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "extract", "$mt.checkout_common_root.$r1t.$r2t.out", "list" ]
+ local:
+ shell on n as list:
+ cat list
+ rm list
+ echo DONE
+ expect from list:
+ /\.\/d1\/file/
+ /\.\/d2_s1\/file1/
+ /\.\/d2_s2\/file2/
+ /(.*)/ capture done
+ guard (done == "DONE")
+
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "checkout_common_subtree" ]
+ expect_success from p of "$mt.checkout_common_subtree.$r3ab"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "$mt.checkout_common_subtree.$r3ab" ]
+ expect_success from p of "$mt.checkout_common_subtree.$r3ab"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "extract", "$mt.checkout_common_subtree.$r3ab.out", "list" ]
+ local:
+ shell on n as list:
+ cat list
+ rm list
+ echo DONE
+ expect from list:
+ /\.\/d3_s1\/file1/
+ /\.\/d3_s2\/file2/
+ /(.*)/ capture done
+ guard (done == "DONE")
+
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "checkout_common_subtree2" ]
+ expect_success from p of "$mt.checkout_common_subtree2.$r1t.$r2s1.$r3abc"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "run", "--rerun-all", "$mt.checkout_common_subtree2.$r1t.$r2s1.$r3abc" ]
+ expect_success from p of "$mt.checkout_common_subtree2.$r1t.$r2s1.$r3abc"
+ expect /(.*)/ from p capture done
+ guard (done == "run-finish")
+ local:
+ spawn on n as p args [ "--storage=minici", "--repo=r1:./dir_r1", "--repo=r2:./dir_r2", "--repo=r3:./dir_r3", "./main", "extract", "$mt.checkout_common_subtree2.$r1t.$r2s1.$r3abc.out", "list" ]
+ local:
+ shell on n as list:
+ cat list
+ rm list
+ echo DONE
+ expect from list:
+ /\.\/d1\/file/
+ /\.\/d2_s1\/file1/
+ /\.\/d3_s2\/file2/
+ /\.\/d3_s3\/file3/
+ /(.*)/ capture done
+ guard (done == "DONE")