aboutsummaryrefslogtreecommitdiff
path: root/tests/rep-fetch.test
blob: e59ebf4c21df3b85fc3bbd8800ced74fb4f1a5e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# file      : tests/rep-fetch.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

.include common.test auth.test config.test remote.test

# Source repository:
#
# rep-fetch
# |-- bar
# |   |-- stable                  -> ../foo/stable (prerequisite)
# |   |   |-- libbar-1.0.0.tar.gz -> libfoo >= 1.0.0
# |   |   `-- repositories
# |   |-- testing                 -> stable (complement),
# |   |   |                          ../foo/testing (prerequisite)
# |   |   |-- libbar-1.1.0.tar.gz -> libfoo >= 1.1.0
# |   |   `-- repositories
# |   `-- unstable                -> testing (complement),
# |       |                          ../foo/testing (prerequisite)
# |       |-- libbar-1.1.1.tar.gz  -> libfoo >= 1.1.0
# |       `-- repositories
# |-- foo
# |   |-- stable
# |   |   |-- libfoo-1.0.0.tar.gz
# |   |   `-- repositories
# |   `-- testing                 -> stable (complement)
# |       |-- libfoo-1.1.0.tar.gz
# |       `-- repositories
# `-- hello
#     |-- libhello-1.0.0.tar.gz
#     `-- repositories

# Prepare repositories used by tests if running in the local mode.
#
+if ($remote != true)
  rep_create += 2>-

  # Create the signed 'hello' repository.
  #
  cp -r $src/hello $out/hello
  cat <<<$cert_manifest >+$out/hello/repositories
  $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature

  # Create 'foo/*' repositories.
  #
  cp -r $src/foo $out/foo
  $rep_create $out/foo/stable  &$out/foo/stable/packages
  $rep_create $out/foo/testing &$out/foo/testing/packages

  # Create 'bar/*' repositories.
  #
  cp -r $src/bar $out/bar
  $rep_create $out/bar/stable   &$out/bar/stable/packages
  $rep_create $out/bar/testing  &$out/bar/testing/packages
  $rep_create $out/bar/unstable &$out/bar/unstable/packages
end

test.options += --auth all

rep_add += -d cfg 2>-

: no-repositories
:
$clone_cfg;
$* 2>>/EOE != 0
  error: configuration cfg/ has no repositories
    info: use 'bpkg rep-add' to add a repository
  EOE

: hello
:
{
  $clone_cfg && $rep_add $rep/hello;

  $* --trust $cert_fp 2>>EOE &cfg/.bpkg/certs/***;
    fetching build2.org/rep-fetch/hello
    1 package(s) in 1 repository(s)
    EOE

  $* 2>>EOE
    fetching build2.org/rep-fetch/hello
    1 package(s) in 1 repository(s)
    EOE
}

: bar-unstable
:
{
  $clone_cfg && $rep_add $rep/bar/unstable;

  $* --trust-yes 2>>EOE;
    fetching build2.org/rep-fetch/bar/unstable
    fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
    fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
    5 package(s) in 5 repository(s)
    EOE

  $* 2>>EOE
    fetching build2.org/rep-fetch/bar/unstable
    fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
    fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
    5 package(s) in 5 repository(s)
    EOE
}

: both
:
{
  $clone_cfg && $rep_add $rep/hello && $rep_add $rep/bar/unstable;

  $* --trust-yes 2>>EOE &cfg/.bpkg/certs/***;
    fetching build2.org/rep-fetch/bar/unstable
    fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
    fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
    fetching build2.org/rep-fetch/hello
    6 package(s) in 6 repository(s)
    EOE

  $* 2>>EOE
    fetching build2.org/rep-fetch/bar/unstable
    fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
    fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
    fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
    fetching build2.org/rep-fetch/hello
    6 package(s) in 6 repository(s)
    EOE
}