Skip to content
Browse files

[tests] Add a test for optional dependencies

  • Loading branch information...
1 parent dc24183 commit 771794643e073d4ca5ab829eaac16217925984b4 @samoht samoht committed May 30, 2012
Showing with 41 additions and 1 deletion.
  1. +17 −1 tests/Makefile
  2. +11 −0 tests/packages/P5.opam
  3. +1 −0 tests/packages/P5/README
  4. +10 −0 tests/packages/P5/build.sh
  5. +2 −0 tests/packages/P5/p5.ml
View
18 tests/Makefile
@@ -18,7 +18,7 @@ BINARIES = opam opam-server \
opam-rsync-init opam-rsync-update opam-rsync-download opam-rsync-upload \
opam-server-init opam-server-update opam-server-download opam-server-upload \
opam-git-init opam-git-update opam-git-download opam-git-upload
-PACKAGES = P1-1 P1-2 P2 P3 P4
+PACKAGES = P1-1 P1-2 P2 P3 P4 P5
# opam in the path should not be a requirement
ENV = OCAMLRUNPARAM=b OPAMDEBUG=1 OPAM_ROOT=$(OPAM_ROOT) PATH=$(BIN):$(PATH)
@@ -43,6 +43,8 @@ run:
$(MAKE) list && \
$(MAKE) install && \
$(MAKE) list && \
+ $(MAKE) install-opt && \
+ $(MAKE) list && \
$(MAKE) upload-new && \
$(MAKE) list && \
$(MAKE) upgrade && \
@@ -108,15 +110,21 @@ ifeq ($(REPOKIND), git)
cp packages/P4/README $(OPAM_REPO)/descr/P4.1
echo '$(OPAM_GIT)/P4' > $(OPAM_REPO)/url/P4.1
cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P4"
+ cp packages/P5.opam $(OPAM_REPO)/opam/P5.opam
+ cp packages/P5/README $(OPAM_REPO)/descr/P5
+ echo '$(OPAM_GIT)/P5' > $(OPAM_REPO)/url/P5
+ cd $(OPAM_REPO) && git add * && git commit -a -m "Adding P5"
rm -rf $(OPAM_GIT) && mkdir -p $(OPAM_GIT)
mkdir $(OPAM_GIT)/P1-1 && cp packages/P1-1/* $(OPAM_GIT)/P1-1/
mkdir $(OPAM_GIT)/P2 && cp packages/P2/* $(OPAM_GIT)/P2/
mkdir $(OPAM_GIT)/P3 && cp packages/P3/* $(OPAM_GIT)/P3/
mkdir $(OPAM_GIT)/P4 && cp packages/P4/* $(OPAM_GIT)/P4/
+ mkdir $(OPAM_GIT)/P5 && cp packages/P5/* $(OPAM_GIT)/P5/
cd $(OPAM_GIT)/P1-1 && git init && git add * && git commit -a -m "initial commit"
cd $(OPAM_GIT)/P2 && git init && git add * && git commit -a -m "initial commit"
cd $(OPAM_GIT)/P3 && git init && git add * && git commit -a -m "initial commit"
cd $(OPAM_GIT)/P4 && git init && git add * && git commit -a -m "initial commit"
+ cd $(OPAM_GIT)/P5 && git init && git add * && git commit -a -m "initial commit"
else
cd packages && \
$(OPAM) upload -opam P1-1.opam -descr P1-1/README -archive P1-1.tar.gz -repo $(REPO)
@@ -126,6 +134,8 @@ else
$(OPAM) upload -opam P3.opam -descr P3/README -archive P3.tar.gz -repo $(REPO)
cd packages && \
$(OPAM) upload -opam P4-1.opam -descr P4/README -archive P4.tar.gz -repo $(REPO)
+ cd packages && \
+ $(OPAM) upload -opam P5.opam -descr P5/README -archive P5.tar.gz -repo $(REPO)
endif
$(OPAM) update # update the list of available packages with the one being updated
@@ -136,6 +146,12 @@ install-remove:
cd packages && $(OPAM) install P1
cd packages && $(OPAM) remove P1
+install-opt:
+ cd packages && $(OPAM) install P5
+ cd packages && $(OPAM) install P2
+ cd packages && $(OPAM) remove P5
+ cd packages && $(OPAM) remove P2
+
install:
$(OPAM) install P1 && \
$(OPAM) install P2 && \
View
11 tests/packages/P5.opam
@@ -0,0 +1,11 @@
+(* API version *)
+opam-version: "1"
+
+package "P5" {
+
+ version: "1"
+ maintainer: "contact@ocamlpro.com"
+ depends: [ "P1" ]
+ depopts: [ "P2" ]
+
+}
View
1 tests/packages/P5/README
@@ -0,0 +1 @@
+Testing optional dependencies
View
10 tests/packages/P5/build.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+OCPGET="opam --root ${OPAM_ROOT}"
+FLAGS="`${OCPGET} config -I P1`"
+
+echo "Bytecode Compilation"
+ocamlopt ${FLAGS} -a p5.ml -o p5.cmxa
+
+echo "Native Compilation"
+ocamlc ${FLAGS} -a p5.ml -o p5.cma
View
2 tests/packages/P5/p5.ml
@@ -0,0 +1,2 @@
+let g () =
+ P1.x ()

0 comments on commit 7717946

Please sign in to comment.
Something went wrong with that request. Please try again.