source: trunk/base/tests/Makefile @ 47321

Last change on this file since 47321 was 47321, checked in by raimue@…, 11 years ago

tests/Makefile:
Include a new test-% target which makes it easier to run a specific test

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1include ../Mk/macports.autoconf.mk
2
3TESTS?=checksums-1 cvs-and-patchsites envvariables site-tags trace universal universal-2 xcodeversion dependencies-c dependencies-d dependencies-e case-insensitive-deactivate variants
4
5PWD=$(shell pwd)
6
7.PHONY: test clean PortIndex
8
9all:
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
26PortIndex:
27        portindex
28
29clean:
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
37test: 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
61test-%:
62        $(MAKE) TESTS="$(@:test-%=%)" test
63
64install:
65
66distclean: clean
Note: See TracBrowser for help on using the repository browser.