aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-14 19:27:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-15 11:08:22 +0300
commit18e40e91c99088ef5fb9458ec4c1ec21ddcc51e6 (patch)
treebbb91a98a375e9cae387f03a7ca1ef32db202d73 /tests
parent02458785b93094dfc65b31a4ecf2a8e690143b03 (diff)
Add support for git manifests
Diffstat (limited to 'tests')
-rw-r--r--tests/manifest/driver.cxx18
-rw-r--r--tests/manifest/testscript358
-rw-r--r--tests/repository-location/driver.cxx44
3 files changed, 297 insertions, 123 deletions
diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx
index b7a87eb..9c58dcf 100644
--- a/tests/manifest/driver.cxx
+++ b/tests/manifest/driver.cxx
@@ -21,8 +21,10 @@ using namespace bpkg;
// Read and parse manifest from STDIN and serialize it to STDOUT. The
// following options specify the manifest type.
//
-// -p parse package manifest list
-// -r parse repository manifest list
+// -bp parse bpkg package manifest list
+// -gp parse git package manifest list
+// -br parse bpkg repository manifest list
+// -gr parse git repository manifest list
// -s parse signature manifest
//
int
@@ -37,10 +39,14 @@ main (int argc, char* argv[])
manifest_parser p (cin, "stdin");
manifest_serializer s (cout, "stdout");
- if (opt == "-p")
- package_manifests (p).serialize (s);
- else if (opt == "-r")
- repository_manifests (p).serialize (s);
+ if (opt == "-bp")
+ bpkg_package_manifests (p).serialize (s);
+ else if (opt == "-br")
+ bpkg_repository_manifests (p).serialize (s);
+ else if (opt == "-gp")
+ git_package_manifests (p).serialize (s);
+ else if (opt == "-gr")
+ git_repository_manifests (p).serialize (s);
else if (opt == "-s")
signature_manifest (p).serialize (s);
else
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 1b0f38f..3f0d38d 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -4,128 +4,262 @@
: packages
:
-: Roundtrip the package manifest list.
-:
{
- : manifest
- :
- $* -p <<EOF >>EOF
- : 1
- sha256sum: a2b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ : bpkg
:
- name: libfoo
- version: 1.2.3+2
- priority: high; Due to critical bug fix.
- summary: Modern XML parser
- license: LGPLv2, MIT; Both required.
- license: BSD
- tags: c++, xml, parser, serializer, pull, streaming, modern
- description: libfoo is a very modern C++ XML parser.
- changes: 1.2.3+2: applied upstream patch for critical bug bar
- changes: 1.2.3+1: applied upstream patch for critical bug foo
- url: http://www.example.org/projects/libfoo/; libfoo project page url
- doc-url: http://www.example.org/projects/libfoo/man.xhtml; documentation page
- src-url: http://scm.example.com/?p=odb/libodb.git\;a=tree; source tree
- package-url: http://www.example.org/projects/libfoo/1.2.3+2; package url
- email: libfoo-users@example.org; Public mailing list, posts by non-members\
- are allowed but moderated.
- package-email: libfoo-1.2.3+2@example.org; Bug reports are welcome.
- build-email: libfoo-builds@example.org; Mailing list for bbot notification\
- emails.
- depends: libz
- depends: libgnutls <= 1.2.3 | libopenssl >= 2.3.4
- depends: ? libboost-regex >= 1.52.0; Only if C++ compiler does not support\
- C++11 <regex>.
- depends: ? libqtcore >= 5.0.0; Only if GUI is enabled.
- requires: linux | windows | macosx; symbian is coming.
- requires: c++11
- requires: ? ; VC++ 12.0 or later if targeting Windows.
- requires: ? ; libc++ standard library if using Clang on Mac OS X.
- requires: zlib; Most Linux/UNIX systems already have one; or get it at\
- www.zlib.net.
- build-include: linux*
- build-include: freebsd*
- build-exclude: *; Only supports Linux and FreeBSD.
- location: libfoo-1.2.3+2.tar.bz2
- sha256sum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- :
- name: libbar
- version: 3.4A.5+6
- summary: Modern bar management framework
- license: LGPLv2
- tags: c++, xml, modern
- url: http://www.example.org/projects/libbar/
- email: libbar-users@example.org
- build-email:
- depends: libbaz (1- 2-) | libbaz [3 4-) | libbaz (5 6] | libbaz [7 8]
- build-exclude: *-msvc_14*/i?86-*; Linker crash.
- location: bar/libbar-3.4A.5+6.tbz
- sha256sum: d4b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ {
+ : manifest
+ :
+ : Roundtrip the bpkg package manifest list.
+ :
+ $* -bp <<EOF >>EOF
+ : 1
+ sha256sum: a2b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ :
+ name: libfoo
+ version: 1.2.3+2
+ priority: high; Due to critical bug fix.
+ summary: Modern XML parser
+ license: LGPLv2, MIT; Both required.
+ license: BSD
+ tags: c++, xml, parser, serializer, pull, streaming, modern
+ description: libfoo is a very modern C++ XML parser.
+ changes: 1.2.3+2: applied upstream patch for critical bug bar
+ changes: 1.2.3+1: applied upstream patch for critical bug foo
+ url: http://www.example.org/projects/libfoo/; libfoo project page url
+ doc-url: http://www.example.org/projects/libfoo/man.xhtml; documentation page
+ src-url: http://scm.example.com/?p=odb/libodb.git\;a=tree; source tree
+ package-url: http://www.example.org/projects/libfoo/1.2.3+2; package url
+ email: libfoo-users@example.org; Public mailing list, posts by non-members\
+ are allowed but moderated.
+ package-email: libfoo-1.2.3+2@example.org; Bug reports are welcome.
+ build-email: libfoo-builds@example.org; Mailing list for bbot notification\
+ emails.
+ depends: libz
+ depends: libgnutls <= 1.2.3 | libopenssl >= 2.3.4
+ depends: ? libboost-regex >= 1.52.0; Only if C++ compiler does not support\
+ C++11 <regex>.
+ depends: ? libqtcore >= 5.0.0; Only if GUI is enabled.
+ requires: linux | windows | macosx; symbian is coming.
+ requires: c++11
+ requires: ? ; VC++ 12.0 or later if targeting Windows.
+ requires: ? ; libc++ standard library if using Clang on Mac OS X.
+ requires: zlib; Most Linux/UNIX systems already have one; or get it at\
+ www.zlib.net.
+ build-include: linux*
+ build-include: freebsd*
+ build-exclude: *; Only supports Linux and FreeBSD.
+ location: libfoo-1.2.3+2.tar.bz2
+ sha256sum: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ :
+ name: libbar
+ version: 3.4A.5+6
+ summary: Modern bar management framework
+ license: LGPLv2
+ tags: c++, xml, modern
+ url: http://www.example.org/projects/libbar/
+ email: libbar-users@example.org
+ build-email:
+ depends: libbaz (1- 2-) | libbaz [3 4-) | libbaz (5 6] | libbaz [7 8]
+ build-exclude: *-msvc_14*/i?86-*; Linker crash.
+ location: bar/libbar-3.4A.5+6.tbz
+ sha256sum: d4b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ :
+ name: libbaz
+ version: 2~3.4A.5+3
+ summary: Modern baz system
+ license: LGPLv2
+ url: http://www.example.org/projects/libbar/
+ email: libbaz-users@example.org
+ location: libbaz/libbaz-2~3.4A.5+3.tar.gz
+ sha256sum: b5b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+ EOF
+ }
+
+ : git
:
- name: libbaz
- version: 2~3.4A.5+3
- summary: Modern baz system
- license: LGPLv2
- url: http://www.example.org/projects/libbar/
- email: libbaz-users@example.org
- location: libbaz/libbaz-2~3.4A.5+3.tar.gz
- sha256sum: b5b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- EOF
+ {
+ : manifest
+ :
+ : Roundtrip the git package manifest list.
+ :
+ $* -gp <<EOF >>EOF
+ : 1
+ location: hello/
+ :
+ location: mhello/
+ EOF
+
+ : empty
+ :
+ : Roundtrip an empty git package manifest list.
+ :
+ $* -gp <"" >:""
+ }
}
: repositories
:
-: Roundtrip the repository manifest list.
-:
{
- : manifest
+ : bpkg
:
- $* -r <<EOF >>EOF
- : 1
- location: http://pkg.example.org/1/math
- role: prerequisite
- :
- location: ../stable
- role: complement
+ {
+ : manifest
+ :
+ : Roundtrip the bpkg repository manifest list.
+ :
+ $* -br <<EOF >>EOF
+ : 1
+ location: http://pkg.example.org/1/math
+ type: bpkg
+ role: prerequisite
+ :
+ location: ../stable
+ type: bpkg
+ role: complement
+ :
+ url: http://cppget.org
+ email: repoman@cppget.org; General mailing list.
+ summary: General C++ package repository
+ description: This is the awesome C++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aNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
+ BwMDMBoGA1UdEQQTMBGBD2luZm9AY3BwZ2V0Lm9yZzANBgkqhkiG9w0BAQsFAAOC
+ AgEAHLfv2w82bBMgDgsRX8GU/3eK6CnyfRu4Auto1XjyHCrD6qcIdmebC0hihpSg
+ 5xSlfVwjPRWBmg3z5/K8ln5jM6KKiWHd47OCfx+DW7wbesq2+6lS1btXpRR2pv7j
+ zG+41Cncu/xVNs9F4CQluVn5xyWFVDUxQfkQqAE46EbkjAmq42y+1ZQnq2Zm47Wr
+ iMRXQtg1yx7Fs2EpVU+sbW4ImuXgv0YbyYbI1lPhvmx8rIL6lybN3evEfIj7crh7
+ 5abWPDZzA+1aNL5tiaSNrn3nS/BfJyEYhGMyy0bsekPZiaqGB1q/mgv2rmR/2SRL
+ Tx+T7sthy/IHTOUbDTY0lUhjc6thQMncgGTaD4TC3QaXhdLWzO9XTh0K7U8BOMwh
+ wppr1G5aTXY0PUB0+Hs+IQZ4mVfBvKO0Wn6GgoDAs/mW9qvbWP3ZnpdvhB52a49P
+ g07JQ+R0QgBNQY7t0lT0mOpAPx79Dwc5R8jQCkx4gTr1bWtgyCvza+gpTgUQDOH5
+ nawOIIDOnRv4heFdvgfEQs2oKa3X4bM+BsgOx7OTvnWCzJy0IXo0uBbcTrMv9Z62
+ +KVwnghQdpURRnUpomt03cTwjqVJVrq287owGv8qqnuGcTTi1SgzNNYREFoljY58
+ CCj4yYvTUzXjcAUXaNC5YNw3JEQp8vmciuJwhyUkbifLrHU=
+ -----END CERTIFICATE-----
+ \
+ EOF
+
+ : prerequisite-type
+ :
+ $* -br <<EOI >>EOO
+ : 1
+ location: http://example.org/math.git#master
+ role: prerequisite
+ :
+ location: ../stable.git
+ role: complement
+ :
+ location: git://example.org/foo#master
+ type: git
+ role: prerequisite
+ :
+ location: http://pkg.example.org/1/bar
+ role: prerequisite
+ :
+ url: http://cppget.org
+ EOI
+ : 1
+ location: http://example.org/math.git#master
+ type: git
+ role: prerequisite
+ :
+ location: ../stable.git
+ type: bpkg
+ role: complement
+ :
+ location: git://example.org/foo#master
+ type: git
+ role: prerequisite
+ :
+ location: http://pkg.example.org/1/bar
+ type: bpkg
+ role: prerequisite
+ :
+ url: http://cppget.org
+ EOO
+ }
+
+ : git
:
- url: http://cppget.org
- email: repoman@cppget.org; General mailing list.
- summary: General C++ package repository
- description: This is the awesome C++ package repository full of exciting\
- stuff.
- certificate: \
- -----BEGIN CERTIFICATE-----
- MIIFLzCCAxegAwIBAgIJAJ71rMp8mDy1MA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
- BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmNwcGdldC5vcmcwHhcN
- MTYwNDA4MTc1NTUwWhcNMTcwNDA4MTc1NTUwWjAzMRcwFQYDVQQKDA5Db2RlIFN5
- bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpjcHBnZXQub3JnMIICIjANBgkqhkiG9w0B
- AQEFAAOCAg8AMIICCgKCAgEAwj7lwxkr19ygfNIzQsiKkmyyRG0c5AwMrwvldEk7
- 2UIwz5kNb04zveUzQcfNFhau60+xC980Y4TKA4/ScfinyaDfp1I3pmiv4OSDUoBw
- 9e8a+4Jyo5fuiAXoAYaQyAdwvH1mIbYq1ObRfKW2MTrUXp/HRJAWHHBnv3VmCYBZ
- dllY1hasA+SBDMBv6iTXkKUIfEdNDk8cjUR3FjxaefIdip9pHR3G0y4iWctS1drq
- AKLE1J0KIJyPsJCvoZnzIeePaCNL/UtRup9mYi2vxHHFD4Ml5Bbp+gE6vq5XhcQz
- LeCcGYKB3UjVWuszcpFIoHACw9ja2JUumbTiclUDgLBk8WXJvLjOCNLp9i/MKQws
- p5CDfrNe2P6u63ZmtW2v0Qpj/6b6JQmqJaMgHQdDEBUFO3bjwm7yyXyvEjj/EAEJ
- pGziWZjan5NKGgKCX1JChQJloMHhzr42YMvceWTMJjAr07Es9v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TIFICATE-----
- \
- EOF
+ {
+ : manifest
+ :
+ : Roundtrip the git repository manifest list.
+ :
+ $* -gr <<EOF >>EOF
+ : 1
+ location: http://example.org/math.git#master
+ type: git
+ role: prerequisite
+ :
+ location: ../stable.git#stable
+ type: git
+ role: complement
+ :
+ url: http://cppget.org
+ email: repoman@cppget.org; General mailing list.
+ summary: General C++ package repository
+ description: This is the awesome C++ package repository full of exciting\
+ stuff.
+ EOF
+
+ : prerequisite-type
+ :
+ $* -gr <<EOI >>EOO
+ : 1
+ location: http://example.org/math.git#master
+ role: prerequisite
+ :
+ location: ../stable.git#stable
+ role: complement
+ :
+ location: git://example.org/foo#master
+ type: git
+ role: prerequisite
+ :
+ location: http://pkg.example.org/1/bar
+ role: prerequisite
+ :
+ url: http://cppget.org
+ EOI
+ : 1
+ location: http://example.org/math.git#master
+ type: git
+ role: prerequisite
+ :
+ location: ../stable.git#stable
+ type: git
+ role: complement
+ :
+ location: git://example.org/foo#master
+ type: git
+ role: prerequisite
+ :
+ location: http://pkg.example.org/1/bar
+ type: bpkg
+ role: prerequisite
+ :
+ url: http://cppget.org
+ EOO
+ }
}
: signature
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx
index ad3b0dd..e4282fe 100644
--- a/tests/repository-location/driver.cxx
+++ b/tests/repository-location/driver.cxx
@@ -33,9 +33,11 @@ namespace bpkg
}
inline static repository_location
- loc (const string& l, const repository_location& b)
+ loc (const string& l,
+ const repository_location& b,
+ repository_type t = repository_type::bpkg)
{
- return repository_location (repository_url (l), b);
+ return repository_location (repository_url (l), t, b);
}
inline static bool
@@ -53,11 +55,13 @@ namespace bpkg
}
inline static bool
- bad_loc (const string& l, const repository_location& b)
+ bad_loc (const string& l,
+ const repository_location& b,
+ repository_type t = repository_type::bpkg)
{
try
{
- repository_location bl (repository_url (l), b);
+ repository_location bl (repository_url (l), t, b);
return false;
}
catch (const invalid_argument&)
@@ -71,7 +75,7 @@ namespace bpkg
{
istringstream is (":1\nurl: " + l);
manifest_parser mp (is, "");
- repository_manifest m (mp);
+ repository_manifest m (bpkg_repository_manifest (mp));
optional<string> u (m.effective_url (r));
assert (u);
@@ -307,6 +311,11 @@ namespace bpkg
assert (l.canonical_name () == "git:/git/repo");
}
{
+ repository_location l (loc ("/git/repo#branch", repository_type::git));
+ assert (l.string () == "file:/git/repo#branch");
+ assert (l.canonical_name () == "git:/git/repo");
+ }
+ {
repository_location l (loc ("file://localhost/#master",
repository_type::git));
assert (l.string () == "file:/#master");
@@ -368,6 +377,12 @@ namespace bpkg
assert (l.canonical_name () == "git:c:\\git\\repo");
}
{
+ repository_location l (loc ("c:\\git\\repo#branch",
+ repository_type::git));
+ assert (l.string () == "file:/c:/git/repo#branch");
+ assert (l.canonical_name () == "git:c:\\git\\repo");
+ }
+ {
repository_location l (loc ("file://localhost/c:/#master",
repository_type::git));
assert (l.string () == "file:/c:#master");
@@ -435,6 +450,7 @@ namespace bpkg
assert (l.string () == "http://example.com/test.git#master");
assert (l.canonical_name () == "git:example.com/test");
assert (l.proto () == proto::http);
+ assert (l.type () == repository_type::git);
}
{
repository_location l (loc ("https://example.com/test.git#master",
@@ -576,6 +592,24 @@ namespace bpkg
assert (l2.canonical_name () == "bpkg:stable.cppget.org:444/math");
assert (l2.proto () == proto::https);
}
+ {
+ repository_location l (loc ("../test.git#master",
+ repository_location (),
+ repository_type::git));
+ assert (l.string () == "../test.git#master");
+ assert (l.canonical_name ().empty ());
+ assert (l.proto () == proto::file);
+ }
+ {
+ repository_location l1 (loc ("https://example.com/stable.git#stable",
+ repository_type::git));
+ repository_location l2 (loc ("../test.git#master",
+ l1,
+ repository_type::git));
+ assert (l2.string () == "https://example.com/test.git#master");
+ assert (l2.canonical_name () == "git:example.com/test");
+ assert (l2.proto () == proto::https);
+ }
#ifndef _WIN32
{
repository_location l1 (loc ("/var/r1/1/misc"));