aboutsummaryrefslogtreecommitdiff
path: root/tests/rep-info.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:02:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:02:11 +0300
commitf8fdb500cc705e2b8b4a74166ceb2c6d8cee3fd3 (patch)
tree3f94b0b79ebad275904b9dc4a4165326ff598492 /tests/rep-info.testscript
parentf727c2b8fe273a12d059826291523060dab4b512 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/rep-info.testscript')
-rw-r--r--tests/rep-info.testscript254
1 files changed, 254 insertions, 0 deletions
diff --git a/tests/rep-info.testscript b/tests/rep-info.testscript
new file mode 100644
index 0000000..3ccbeb6
--- /dev/null
+++ b/tests/rep-info.testscript
@@ -0,0 +1,254 @@
+# file : tests/rep-info.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript \
+ auth.testscript \
+ remote.testscript \
+ remote-git.testscript
+
+# Source repository:
+#
+# rep-info
+# |-- testing -> stable (complement), ../foo/testing (prerequisite)
+# | |-- foo-1.tar.gz
+# | `-- repositories.manifest
+# |
+# `-- git
+# |-- libbar.git -> style-basic.git (prerequisite)
+# `-- style-basic.git
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rc = $rep_create 2>!
+
+ # Create the unsigned 'testing' repository.
+ #
+ cp -r $src/testing $out/testing
+ $rc $out/testing &$out/testing/packages.manifest
+
+ # Create the signed 'testing' repository.
+ #
+ cp -r $src/testing $out/signed
+ cat <<<$cert_manifest >+$out/signed/repositories.manifest
+
+ $rc --key $key $out/signed &$out/signed/packages.manifest \
+ &$out/signed/signature.manifest
+
+ # Create git repositories.
+ #
+ $git_extract $src/git/libbar.tar
+ $git_extract $src/git/style-basic.tar &$out_git/state0/***
+end
+
+test.options += --auth all --trust-yes
+
+: no-location
+:
+$* 2>>EOE != 0
+error: repository location argument expected
+ info: run 'bpkg help rep-info' for more information
+EOE
+
+: default
+:
+{
+ : unsigned
+ :
+ $* $rep/testing >>"EOO"
+ pkg:build2.org/rep-info/testing ($rep/testing)
+ prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement pkg:build2.org/rep-info/stable ($rep/stable)
+
+ foo/1
+ EOO
+
+ : signed
+ :
+ $* $rep/signed >>"EOO"
+ pkg:build2.org/rep-info/signed ($rep/signed)
+ CN=build2.org/O=Code Synthesis/info@build2.org
+ $cert_fp
+ prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement pkg:build2.org/rep-info/stable ($rep/stable)
+
+ foo/1
+ EOO
+}
+
+: name
+:
+$* --name $rep/testing >"pkg:build2.org/rep-info/testing ($rep/testing)"
+
+: packages
+:
+{
+ test.arguments += --packages # Should go after the rep-info command argument.
+
+ : list
+ :
+ $* $rep/testing >>EOO
+
+ foo/1
+ EOO
+
+ : manifest
+ :
+ $* --manifest $rep/testing >>EOO
+ : 1
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+
+ : to-file
+ :
+ {
+ : no-manifest
+ :
+ $* --packages-file m $rep/testing 2>>EOE != 0
+ error: --packages-file specified without --manifest
+ info: run 'bpkg help rep-info' for more information
+ EOE
+
+ : manifest
+ :
+ {
+ $* --manifest --packages-file m $rep/testing &m;
+
+ cat m >>EOO
+ : 1
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+ }
+ }
+}
+
+: repositories
+:
+{
+ # Should go after the rep-info command argument.
+ #
+ test.arguments += --repositories
+
+ : list
+ :
+ $* $rep/testing >>"EOO"
+ prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement pkg:build2.org/rep-info/stable ($rep/stable)
+ EOO
+
+ : manifest
+ :
+ $* --manifest $rep/testing >>EOO
+ : 1
+ location: ../../foo/testing
+ type: pkg
+ role: prerequisite
+ :
+ location: ../stable
+ type: pkg
+ role: complement
+ :
+ EOO
+
+ : to-file
+ :
+ {
+ : no-manifest
+ :
+ $* --repositories-file m $rep/testing 2>>EOE != 0
+ error: --repositories-file specified without --manifest
+ info: run 'bpkg help rep-info' for more information
+ EOE
+
+ : manifest
+ :
+ {
+ $* --manifest --repositories-file m $rep/testing &m;
+
+ cat m >>EOO
+ : 1
+ location: ../../foo/testing
+ type: pkg
+ role: prerequisite
+ :
+ location: ../stable
+ type: pkg
+ role: complement
+ :
+ EOO
+ }
+ }
+}
+
+: cert
+:
+{
+ test.arguments += $rep/signed
+
+ $* --cert-fingerprint >"$cert_fp" : fingerprint
+ $* --cert-name >'name:build2.org' : name
+ $* --cert-organization >'Code Synthesis' : organization
+ $* --cert-email >'info@build2.org' : email
+}
+
+: git-rep
+:
+if ($git_supported != true)
+{
+ # Skip git repository tests.
+ #
+}
+else
+{
+ rep = "$rep_git/state0"
+ test.redirects += 2>!
+
+ : version-module
+ :
+ : Version module is enabled for the project.
+ :
+ $* "$rep/style-basic.git#master" >>~%EOO%
+ %git:.+style-basic#master .+style-basic.git#master%
+
+ %style-basic/1\.1\.0-a\.0\.\d+\..+%
+ EOO
+
+ : manifest-lists
+ :
+ : The packages.manifest and repositories.manifest files are present in the
+ : repository root.
+ :
+ $* "$rep/libbar.git#master" >>~%EOO%
+ %git:.+libbar#master .+libbar.git#master%
+ %prerequisite git:.+style-basic#stable .+style-basic.git#stable%
+
+ libbar/1.0.0
+ libmbar/1.0.0
+ EOO
+
+ : repository-manifests
+ :
+ : Here we test that the base repository manifest that comes from the stable
+ : branch is printed because the stable head commit is newer that of the
+ : master branch.
+ :
+ $* -r --manifest "$rep/style-basic.git#stable,master" >>~%EOO%
+ : 1
+ email: user@example.com
+ EOO
+}