| 1 | include ../Mk/macports.autoconf.mk |
|---|
| 2 | |
|---|
| 3 | TESTS?=checksums-1 cvs-and-patchsites envvariables site-tags trace universal universal-2 xcodeversion dependencies-c dependencies-d dependencies-e case-insensitive-deactivate variants |
|---|
| 4 | |
|---|
| 5 | PWD=$(shell pwd) |
|---|
| 6 | |
|---|
| 7 | .PHONY: test clean PortIndex |
|---|
| 8 | |
|---|
| 9 | all: |
|---|
| 10 | |
|---|
| 11 | /tmp/macports-tests/opt/local/etc/macports/sources.conf: sources.conf |
|---|
| 12 | @echo setting up test installation |
|---|
| 13 | rm -rf /tmp/macports-tests/ |
|---|
| 14 | mkdir -p /tmp/macports-tests/ports |
|---|
| 15 | mkdir -p /tmp/macports-tests/opt/local/etc/macports/ |
|---|
| 16 | mkdir -p /tmp/macports-tests/opt/local/share/ |
|---|
| 17 | mkdir -p /tmp/macports-tests/opt/local/var/macports/receipts/ |
|---|
| 18 | mkdir -p /tmp/macports-tests/opt/local/var/macports/build/ |
|---|
| 19 | ln -s $(datadir)/macports /tmp/macports-tests/opt/local/share/ |
|---|
| 20 | ln -s $(PWD)/test /tmp/macports-tests/ports/ |
|---|
| 21 | cp sources.conf /tmp/macports-tests/opt/local/etc/macports/ |
|---|
| 22 | |
|---|
| 23 | /tmp/macports-tests/ports/PortIndex: /tmp/macports-tests/opt/local/etc/macports/sources.conf PortIndex |
|---|
| 24 | cp PortIndex /tmp/macports-tests/ports/PortIndex |
|---|
| 25 | |
|---|
| 26 | PortIndex: |
|---|
| 27 | portindex |
|---|
| 28 | |
|---|
| 29 | clean: |
|---|
| 30 | rm -rf /tmp/macports-tests/ |
|---|
| 31 | rm -f PortIndex |
|---|
| 32 | |
|---|
| 33 | $(bindir)/port: |
|---|
| 34 | @echo "Please install MacPorts before running these tests" |
|---|
| 35 | @exit 1 |
|---|
| 36 | |
|---|
| 37 | test: clean /tmp/macports-tests/ports/PortIndex /tmp/macports-tests/opt/local/etc/macports/sources.conf |
|---|
| 38 | @for testname in $(TESTS); do\ |
|---|
| 39 | subdir=test/$$testname; \ |
|---|
| 40 | echo ===\> test ${DIRPRFX}$$subdir; \ |
|---|
| 41 | if [ -e ${DIRPRFX}$$subdir/Makefile ]; then \ |
|---|
| 42 | ( cd $$subdir && \ |
|---|
| 43 | $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ PORTSRC=$(PWD)/test-macports.conf test) || exit 1; \ |
|---|
| 44 | else \ |
|---|
| 45 | ( cd $$subdir && \ |
|---|
| 46 | PORTSRC=$(PWD)/test-macports.conf $(bindir)/port clean > /dev/null && \ |
|---|
| 47 | PORTSRC=$(PWD)/test-macports.conf $(bindir)/port test > output 2>&1 \ |
|---|
| 48 | || (cat output; exit 1) && \ |
|---|
| 49 | sed -e "s|${PWD}|PWD|g" < output > output.sed && \ |
|---|
| 50 | diff output.sed master 2>&1 | tee difference && \ |
|---|
| 51 | if [ -s difference ]; then \ |
|---|
| 52 | exit 1; \ |
|---|
| 53 | else \ |
|---|
| 54 | rm -f difference output.sed; \ |
|---|
| 55 | fi) \ |
|---|
| 56 | fi || exit 1; \ |
|---|
| 57 | done |
|---|
| 58 | @rm -rf /tmp/macports-tests/ |
|---|
| 59 | @rm -f PortIndex |
|---|
| 60 | |
|---|
| 61 | install: |
|---|
| 62 | |
|---|
| 63 | distclean: clean |
|---|