Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 173 lines (151 sloc) 5.645 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
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
17 BINARIES = opam opam-server \
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
abc2630 @samoht Clean-up the functional tests
samoht authored
21 PACKAGES = P1-1 P1-2 P2 P3 P4
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)
25 OPAM = $(ENV) opam --root $(OPAM_ROOT)
7f510c5 @samoht Few makefile tweaks
samoht authored
26
abc2630 @samoht Clean-up the functional tests
samoht authored
27 BINARIES_ = $(BINARIES:%=$(BIN)/%)
28 BUILDS = $(foreach bin, $(BINARIES), ../_obuild/$(bin)/$(bin).asm)
29 ARCHIVES = $(PACKAGES:%=packages/%.tar.gz)
5cf8b97 @samoht Improve test Makefile
samoht authored
30
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
31 .PHONY: fresh init upload list install upload-new upgrade downgrade remove
32
33 all:
34 $(MAKE) fresh && \
35 $(MAKE) $(BINARIES_) && \
36 $(MAKE) init && \
37 $(MAKE) list && \
38 $(MAKE) upload && \
39 $(MAKE) install-remove && \
40 $(MAKE) list && \
41 $(MAKE) install && \
42 $(MAKE) list && \
43 $(MAKE) upload-new && \
44 $(MAKE) list && \
45 $(MAKE) upgrade && \
46 $(MAKE) list && \
47 $(MAKE) downgrade && \
48 $(MAKE) list
49
50 server:
51 $(MAKE) fresh
52 $(MAKE) binaries
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
53 rm -rf $(OPAM_SERVER_ROOT)
54 ($(ENV) opam-server --root $(OPAM_SERVER_ROOT) & \
55 (sleep 1 && $(MAKE) REPOKIND=server OPAM_REPO=$(OPAM_SERVER) all \
56 && killall opam-server || killall opam-server))
57
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
58 git:
59 $(MAKE) REPOKIND=git all
60
abc2630 @samoht Clean-up the functional tests
samoht authored
61 $(BINARIES_): $(BUILDS)
4e3553f Modified for the demo
Fabrice Le Fessant authored
62 mkdir -p $(BIN)
abc2630 @samoht Clean-up the functional tests
samoht authored
63 for bin in $(BINARIES); do \
64 cp ../_obuild/$$bin/$$bin.asm $(BIN)/$$bin ; \
65 done
1bcaf57 @samoht New format for user provided files
samoht authored
66
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
67 init:
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
68 ifeq ($(REPOKIND),rsync)
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
69 mkdir -p $(OPAM_REPO)
abc2630 @samoht Clean-up the functional tests
samoht authored
70 mkdir $(OPAM_REPO)/opam
71 mkdir $(OPAM_REPO)/descr
72 mkdir $(OPAM_REPO)/archive
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
73 endif
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
74 ifeq ($(REPOKIND), git)
75 rm -rf $(OPAM_REPO)
76 mkdir -p $(OPAM_REPO)
77 mkdir $(OPAM_REPO)/opam
78 mkdir $(OPAM_REPO)/descr
79 mkdir $(OPAM_REPO)/url
80 cd $(OPAM_REPO) && git init && \
81 touch README && git add README && \
82 git commit -a -m "Initial commit"
83 endif
efb851f @samoht [tests] make tests-server runs the functional tests with an OPAM server ...
samoht authored
84 $(OPAM) init $(REPO) $(OPAM_REPO) --kind $(REPOKIND)
7f510c5 @samoht Few makefile tweaks
samoht authored
85
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
86 upload: $(ARCHIVES)
87 ifeq ($(REPOKIND), git)
88 cp packages/P1-1.opam $(OPAM_REPO)/opam/P1.1.opam
89 cp packages/P1-1/README $(OPAM_REPO)/descr/P1.1
90 echo '$(OPAM_GIT)/P1-1' > $(OPAM_REPO)/url/P1.1
91 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P1"
92 cp packages/P2/README $(OPAM_REPO)/descr/P2.1
93 cp packages/P2.opam $(OPAM_REPO)/opam/P2.1.opam
94 echo '$(OPAM_GIT)/P2' > $(OPAM_REPO)/url/P2.1
95 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P2"
96 cp packages/P3.opam $(OPAM_REPO)/opam/P3.1~weird-version.test.opam
97 cp packages/P3/README $(OPAM_REPO)/descr/P3.1~weird-version.test
98 echo '$(OPAM_GIT)/P3' > $(OPAM_REPO)/url/P3.1~weird-version.test
99 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P3"
100 cp packages/P4-1.opam $(OPAM_REPO)/opam/P4.1.opam
101 cp packages/P4/README $(OPAM_REPO)/descr/P4.1
102 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.1
103 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P4"
104 rm -rf $(OPAM_GIT) && mkdir -p $(OPAM_GIT)
105 mkdir $(OPAM_GIT)/P1-1 && cp packages/P1-1/* $(OPAM_GIT)/P1-1/
106 mkdir $(OPAM_GIT)/P2 && cp packages/P2/* $(OPAM_GIT)/P2/
107 mkdir $(OPAM_GIT)/P3 && cp packages/P3/* $(OPAM_GIT)/P3/
108 mkdir $(OPAM_GIT)/P4 && cp packages/P4/* $(OPAM_GIT)/P4/
109 cd $(OPAM_GIT)/P1-1 && git init && git add * && git commit -a -m "initial commit"
110 cd $(OPAM_GIT)/P2 && git init && git add * && git commit -a -m "initial commit"
111 cd $(OPAM_GIT)/P3 && git init && git add * && git commit -a -m "initial commit"
112 cd $(OPAM_GIT)/P4 && git init && git add * && git commit -a -m "initial commit"
113 else
abc2630 @samoht Clean-up the functional tests
samoht authored
114 cd packages && \
115 $(OPAM) upload -opam P1-1.opam -descr P1-1/README -archive P1-1.tar.gz -repo $(REPO)
116 cd packages && \
117 $(OPAM) upload -opam P2.opam -descr P2/README -archive P2.tar.gz -repo $(REPO)
118 cd packages && \
119 $(OPAM) upload -opam P3.opam -descr P3/README -archive P3.tar.gz -repo $(REPO)
120 cd packages && \
121 $(OPAM) upload -opam P4-1.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
122 endif
f6f4b18 @tuong fix "opam list" (tests was wrong during the 'upgrade' rule)
tuong authored
123 $(OPAM) update # update the list of available packages with the one being updated
7f510c5 @samoht Few makefile tweaks
samoht authored
124
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
125 list:
abc2630 @samoht Clean-up the functional tests
samoht authored
126 $(OPAM) list
7f510c5 @samoht Few makefile tweaks
samoht authored
127
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
128 install-remove:
abc2630 @samoht Clean-up the functional tests
samoht authored
129 cd packages && $(OPAM) install P1
130 cd packages && $(OPAM) remove P1
a802765 @samoht Add a simple remove tests
samoht authored
131
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
132 install:
133 $(OPAM) install P1 && \
134 $(OPAM) install P2 && \
135 $(OPAM) install P3 && \
abc2630 @samoht Clean-up the functional tests
samoht authored
136 $(OPAM) install P4
a779ca3 @samoht More tests
samoht authored
137
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
138 upload-new:
139 ifeq ($(REPOKIND), git)
140 echo "(* new line *)" >> $(OPAM_GIT)/P1-1/p1.ml
141 cd $(OPAM_GIT)/P1-1 && git commit -a -m "a small change"
142 cp packages/P4-2.opam $(OPAM_REPO)/opam/P4.2.opam
143 cp packages/P4/README $(OPAM_REPO)/descr/P4.2
144 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.2
145 cp packages/P4-3.opam $(OPAM_REPO)/opam/P4.3.opam
146 cp packages/P4/README $(OPAM_REPO)/descr/P4.3
147 echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.3
148 cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P4.2 and P4.3"
149 else
abc2630 @samoht Clean-up the functional tests
samoht authored
150 cd packages && \
151 $(OPAM) upload -opam P1-2.opam -descr P1-2/README -archive P1-2.tar.gz -repo $(REPO)
152 cd packages && \
153 $(OPAM) upload -opam P4-2.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
154 cd packages && \
155 $(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
156 endif
f6f4b18 @tuong fix "opam list" (tests was wrong during the 'upgrade' rule)
tuong authored
157 $(OPAM) update # update the list of available packages with the one being updated
158
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
159 upgrade:
abc2630 @samoht Clean-up the functional tests
samoht authored
160 $(OPAM) upgrade
757fe55 @samoht Add more tests
samoht authored
161
e1744d3 @samoht [tests] Aslo test the git repository pluggins
samoht authored
162 downgrade:
abc2630 @samoht Clean-up the functional tests
samoht authored
163 $(OPAM) install P4.2
7e293d3 @tuong Finish the bootstrap (for the case we only consider the library part of ...
tuong authored
164
5cf8b97 @samoht Improve test Makefile
samoht authored
165 packages/%.tar.gz: packages/% packages/%/*
7f510c5 @samoht Few makefile tweaks
samoht authored
166 cd packages && tar cz $* > $*.tar.gz
167
168 clean:
169 rm -f $(ARCHIVES)
170
171 fresh:
abc2630 @samoht Clean-up the functional tests
samoht authored
172 rm -rf $(OPAM_ROOT) $(OPAM_REPO) $(BIN)
Something went wrong with that request. Please try again.