Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 220 lines (193 sloc) 7.117 kb
4e3553f Modified for the demo
Fabrice Le Fessant authored
1 # never use /tmp
2 # should be absolute
3 TEST_DIR=/tmp
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
4 OPAM_ROOT = $(TEST_DIR)/OPAM.ROOT
abc2630 @samoht Clean-up the functional tests
samoht authored
5 OPAM_REPO = $(TEST_DIR)/OPAM.REPO
6 BIN = $(TEST_DIR)/OPAM.BIN
7 REPO = test
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
8 REPOKIND ?= rsync
4e3553f Modified for the demo
Fabrice Le Fessant authored
9
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
10 # To test OPAM server repositories
11 OPAM_SERVER_ROOT = $(TEST_DIR)/OPAM.SERVER
12 OPAM_SERVER = 127.0.0.1
13
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
14 # To test GIT repo
15 OPAM_GIT = $(TEST_DIR)/OPAM.GIT
16
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
17 BINARIES = opam opam-server opam-check \
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
18 opam-rsync-init opam-rsync-update opam-rsync-download opam-rsync-upload \
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
19 opam-server-init opam-server-update opam-server-download opam-server-upload \
20 opam-git-init opam-git-update opam-git-download opam-git-upload
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
21 PACKAGES = P1-1 P1-2 P2 P3 P4 P5
f8dc221 @samoht Add --root to ocp-get and ocp-get-server to change the default root path...
samoht authored
22
abc2630 @samoht Clean-up the functional tests
samoht authored
23 # opam in the path should not be a requirement
24 ENV = OCAMLRUNPARAM=b OPAMDEBUG=1 OPAM_ROOT=$(OPAM_ROOT) PATH=$(BIN):$(PATH)
76b6c57 @samoht Add a --yes option to always answer yes to OPAM questions
samoht authored
25 OPAM = $(ENV) opam --yes --root $(OPAM_ROOT)
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
26 CHECK = $(ENV) opam-check --root $(OPAM_ROOT)
7f510c5 @samoht Few makefile tweaks
samoht authored
27
abc2630 @samoht Clean-up the functional tests
samoht authored
28 BINARIES_ = $(BINARIES:%=$(BIN)/%)
29 BUILDS = $(foreach bin, $(BINARIES), ../_obuild/$(bin)/$(bin).asm)
30 ARCHIVES = $(PACKAGES:%=packages/%.tar.gz)
5cf8b97 @samoht Improve test Makefile
samoht authored
31
ec59f94 @samoht [tests] make tests should test all the backends
samoht authored
32 .PHONY: all rsync server git
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
33
ec59f94 @samoht [tests] make tests should test all the backends
samoht authored
34 all: rsync server git
35 @
36
37 run:
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
38 $(MAKE) fresh && \
989148e @tuong add a shortcut to the rule 'binaries'
tuong authored
39 $(MAKE) binaries && \
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
40 $(MAKE) init && \
41 $(MAKE) list && \
42 $(MAKE) upload && \
43 $(MAKE) install-remove && \
44 $(MAKE) list && \
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
45 $(MAKE) install-opt && \
46 $(MAKE) list && \
1089c50 @samoht [test] fix the rsync & server tests. git tests are still broken
samoht authored
47 $(MAKE) install && \
48 $(MAKE) list && \
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
49 $(MAKE) upload-new && \
50 $(MAKE) list && \
51 $(MAKE) upgrade && \
52 $(MAKE) list && \
53 $(MAKE) downgrade && \
146a38d @tuong fix the error when "opam list" after "opam switch"
tuong authored
54 $(MAKE) list
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
55
ec59f94 @samoht [tests] make tests should test all the backends
samoht authored
56 rsync:
57 $(MAKE) REPOKIND=rsync run
58
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
59 server:
60 $(MAKE) fresh
61 $(MAKE) binaries
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
62 rm -rf $(OPAM_SERVER_ROOT)
63 ($(ENV) opam-server --root $(OPAM_SERVER_ROOT) & \
ec59f94 @samoht [tests] make tests should test all the backends
samoht authored
64 (sleep 1 && $(MAKE) REPOKIND=server OPAM_REPO=$(OPAM_SERVER) run \
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
65 && killall opam-server || killall opam-server))
66
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
67 git:
ec59f94 @samoht [tests] make tests should test all the backends
samoht authored
68 $(MAKE) REPOKIND=git run
7f510c5 @samoht Few makefile tweaks
samoht authored
69
abc2630 @samoht Clean-up the functional tests
samoht authored
70 $(BINARIES_): $(BUILDS)
4e3553f Modified for the demo
Fabrice Le Fessant authored
71 mkdir -p $(BIN)
abc2630 @samoht Clean-up the functional tests
samoht authored
72 for bin in $(BINARIES); do \
73 cp ../_obuild/$$bin/$$bin.asm $(BIN)/$$bin ; \
74 done
1bcaf57 @samoht New format for user provided files
samoht authored
75
989148e @tuong add a shortcut to the rule 'binaries'
tuong authored
76 binaries: $(BINARIES_)
77
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
78 init:
79 rm -rf $(OPAM_REPO)
80 mkdir -p $(OPAM_REPO)
81 mkdir $(OPAM_REPO)/opam
82 mkdir $(OPAM_REPO)/descr
f8132ef @samoht [tests] add a switch test
samoht authored
83 mkdir $(OPAM_REPO)/compilers
84 ifeq ($(REPOKIND), git)
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
85 mkdir $(OPAM_REPO)/url
86 cd $(OPAM_REPO) && git init && \
87 touch README && git add README && \
88 git commit -a -m "Initial commit"
89 endif
0ebf54c @samoht Only globals args starts by --, so rename --kind to -kind
samoht authored
90 $(OPAM) init $(REPO) $(OPAM_REPO) -kind $(REPOKIND)
7f510c5 @samoht Few makefile tweaks
samoht authored
91
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
92 upload: $(ARCHIVES)
93 ifeq ($(REPOKIND), git)
94 cp packages/P1-1.opam $(OPAM_REPO)/opam/P1.1.opam
95 cp packages/P1-1/README $(OPAM_REPO)/descr/P1.1
96 echo '$(OPAM_GIT)/P1-1' > $(OPAM_REPO)/url/P1.1
97 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P1"
98 cp packages/P2/README $(OPAM_REPO)/descr/P2.1
99 cp packages/P2.opam $(OPAM_REPO)/opam/P2.1.opam
100 echo '$(OPAM_GIT)/P2' > $(OPAM_REPO)/url/P2.1
101 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P2"
102 cp packages/P3.opam $(OPAM_REPO)/opam/P3.1~weird-version.test.opam
103 cp packages/P3/README $(OPAM_REPO)/descr/P3.1~weird-version.test
104 echo '$(OPAM_GIT)/P3' > $(OPAM_REPO)/url/P3.1~weird-version.test
105 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P3"
106 cp packages/P4-1.opam $(OPAM_REPO)/opam/P4.1.opam
107 cp packages/P4/README $(OPAM_REPO)/descr/P4.1
108 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.1
109 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P4"
c37dcfa @samoht [tests] fix git tests
samoht authored
110 cp packages/P5.opam $(OPAM_REPO)/opam/P5.1.opam
111 cp packages/P5/README $(OPAM_REPO)/descr/P5.1
112 echo '$(OPAM_GIT)/P5' > $(OPAM_REPO)/url/P5.1
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
113 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P5"
f8132ef @samoht [tests] add a switch test
samoht authored
114 cp compilers/* $(OPAM_REPO)/compilers/
115 cd $(OPAM_REPO)/compilers && git add * && git commit -a -m "Adding compilers"
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
116 rm -rf $(OPAM_GIT) && mkdir -p $(OPAM_GIT)
117 mkdir $(OPAM_GIT)/P1-1 && cp packages/P1-1/* $(OPAM_GIT)/P1-1/
118 mkdir $(OPAM_GIT)/P2 && cp packages/P2/* $(OPAM_GIT)/P2/
119 mkdir $(OPAM_GIT)/P3 && cp packages/P3/* $(OPAM_GIT)/P3/
120 mkdir $(OPAM_GIT)/P4 && cp packages/P4/* $(OPAM_GIT)/P4/
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
121 mkdir $(OPAM_GIT)/P5 && cp packages/P5/* $(OPAM_GIT)/P5/
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
122 cd $(OPAM_GIT)/P1-1 && git init && git add * && git commit -a -m "initial commit"
123 cd $(OPAM_GIT)/P2 && git init && git add * && git commit -a -m "initial commit"
124 cd $(OPAM_GIT)/P3 && git init && git add * && git commit -a -m "initial commit"
125 cd $(OPAM_GIT)/P4 && git init && git add * && git commit -a -m "initial commit"
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
126 cd $(OPAM_GIT)/P5 && git init && git add * && git commit -a -m "initial commit"
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
127 else
abc2630 @samoht Clean-up the functional tests
samoht authored
128 cd packages && \
129 $(OPAM) upload -opam P1-1.opam -descr P1-1/README -archive P1-1.tar.gz -repo $(REPO)
130 cd packages && \
131 $(OPAM) upload -opam P2.opam -descr P2/README -archive P2.tar.gz -repo $(REPO)
132 cd packages && \
133 $(OPAM) upload -opam P3.opam -descr P3/README -archive P3.tar.gz -repo $(REPO)
134 cd packages && \
135 $(OPAM) upload -opam P4-1.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
136 cd packages && \
137 $(OPAM) upload -opam P5.opam -descr P5/README -archive P5.tar.gz -repo $(REPO)
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
138 endif
f8132ef @samoht [tests] add a switch test
samoht authored
139 cp compilers/* $(OPAM_REPO)/compilers/
f6f4b18 @tuong fix "opam list" (tests was wrong during the 'upgrade' rule)
tuong authored
140 $(OPAM) update # update the list of available packages with the one being updated
7f510c5 @samoht Few makefile tweaks
samoht authored
141
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
142 list:
abc2630 @samoht Clean-up the functional tests
samoht authored
143 $(OPAM) list
7f510c5 @samoht Few makefile tweaks
samoht authored
144
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
145 install-remove:
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
146 $(OPAM) install P1 &&\
147 $(CHECK) -l install-remove P1.1 &&\
148 $(OPAM) remove P1
a802765 @samoht Add a simple remove tests
samoht authored
149
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
150 install-opt:
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
151 $(OPAM) install P5 &&\
152 $(CHECK) -l install-opt P1.1 P5.1 &&\
153 $(OPAM) install P2 &&\
154 $(CHECK) -l install-opt P1.1 P2.1 P5.1 &&\
155 $(OPAM) remove P5 &&\
156 $(OPAM) remove P2 &&\
157 $(OPAM) remove P1 &&\
158 $(CHECK) -l install-opt
7717946 @samoht [tests] Add a test for optional dependencies
samoht authored
159
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
160 install:
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
161 $(OPAM) install P1 &&\
162 $(CHECK) -l install P1.1 &&\
163 $(OPAM) install P2 &&\
164 $(CHECK) -l install P1.1 P2.1 &&\
165 $(OPAM) install P3 &&\
166 $(CHECK) -l install P1.1 P2.1 P3.1~weird-version.test &&\
167 $(OPAM) install P4 &&\
168 $(CHECK) -l install P1.1 P2.1 P3.1~weird-version.test P4.1
a779ca3 @samoht More tests
samoht authored
169
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
170 upload-new:
171 ifeq ($(REPOKIND), git)
172 echo "(* new line *)" >> $(OPAM_GIT)/P1-1/p1.ml
173 cd $(OPAM_GIT)/P1-1 && git commit -a -m "a small change"
174 cp packages/P4-2.opam $(OPAM_REPO)/opam/P4.2.opam
175 cp packages/P4/README $(OPAM_REPO)/descr/P4.2
176 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.2
177 cp packages/P4-3.opam $(OPAM_REPO)/opam/P4.3.opam
178 cp packages/P4/README $(OPAM_REPO)/descr/P4.3
179 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.3
180 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P4.2 and P4.3"
181 else
abc2630 @samoht Clean-up the functional tests
samoht authored
182 cd packages && \
183 $(OPAM) upload -opam P1-2.opam -descr P1-2/README -archive P1-2.tar.gz -repo $(REPO)
184 cd packages && \
185 $(OPAM) upload -opam P4-2.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
186 cd packages && \
187 $(OPAM) upload -opam P4-3.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
188 endif
f6f4b18 @tuong fix "opam list" (tests was wrong during the 'upgrade' rule)
tuong authored
189 $(OPAM) update # update the list of available packages with the one being updated
190
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
191 upgrade:
abc2630 @samoht Clean-up the functional tests
samoht authored
192 $(OPAM) upgrade
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
193 ifeq ($(REPOKIND), git)
194 $(CHECK) -l upgrade P1.1 P2.1 P3.1~weird-version.test P4.3
195 else
196 $(CHECK) -l upgrade P1.2 P2.1 P3.1~weird-version.test P4.3
197 endif
757fe55 @samoht Add more tests
samoht authored
198
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
199 downgrade:
abc2630 @samoht Clean-up the functional tests
samoht authored
200 $(OPAM) install P4.2
ccf5fe4 @samoht [tests] explicitely verify that the installed versions are really the on...
samoht authored
201 $(CHECK) -l downgrade P1.1 P2.1 P3.1~weird-version.test P4.2
7e293d3 @tuong Finish the bootstrap (for the case we only consider the library part of ...
tuong authored
202
6b3599b @tuong Merge branch 'release-0.1' of github.com:OCamlPro/opam into release-0.1
tuong authored
203 switch:
f8132ef @samoht [tests] add a switch test
samoht authored
204 $(MAKE) fresh
205 $(MAKE) binaries
206 $(MAKE) init
207 $(MAKE) upload
208 $(MAKE) install
209 $(OPAM) switch -list
210 $(OPAM) switch -clone 3.12.1-byte
7892d49 @tuong Towards the complete support of "opam switch".
tuong authored
211
5cf8b97 @samoht Improve test Makefile
samoht authored
212 packages/%.tar.gz: packages/% packages/%/*
7f510c5 @samoht Few makefile tweaks
samoht authored
213 cd packages && tar cz $* > $*.tar.gz
214
215 clean:
216 rm -f $(ARCHIVES)
217
218 fresh:
abc2630 @samoht Clean-up the functional tests
samoht authored
219 rm -rf $(OPAM_ROOT) $(OPAM_REPO) $(BIN)
Something went wrong with that request. Please try again.