source: trunk/base/tests/Makefile @ 47324

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

tests/Makefile:
Add some documentation for the test targets

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 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
37# Run all tests
38# Use TESTS to choose which tests to run
39# For example: make test TESTS="checkums-1 universal"
40test: clean /tmp/macports-tests/ports/PortIndex /tmp/macports-tests/opt/local/etc/macports/sources.conf
41        @for testname in $(TESTS); do\
42            subdir=test/$$testname; \
43                echo ===\> test ${DIRPRFX}$$subdir; \
44                if [ -e ${DIRPRFX}$$subdir/Makefile ]; then \
45                        ( cd $$subdir && \
46                                $(MAKE) DIRPRFX=${DIRPRFX}$$subdir/ PORTSRC=$(PWD)/test-macports.conf test) || exit 1; \
47                else \
48                        ( cd $$subdir && \
49                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port clean > /dev/null && \
50                                PORTSRC=$(PWD)/test-macports.conf $(bindir)/port test > output 2>&1 \
51                                        || (cat output; exit 1) && \
52                        sed -e "s|${PWD}|PWD|g" < output > output.sed && \
53                        diff output.sed master 2>&1 | tee difference && \
54                        if [ -s difference ]; then \
55                                exit 1; \
56                        else \
57                                rm -f difference output.sed; \
58                        fi) \
59                fi || exit 1; \
60        done
61        @rm -rf /tmp/macports-tests/
62        @rm -f PortIndex
63
64# Run specific test
65# Prepend the directory name with "test-" and use it as target
66# For example: make test-checksums-1
67test-%:
68        $(MAKE) TESTS="$(@:test-%=%)" test
69
70install:
71
72distclean: clean
Note: See TracBrowser for help on using the repository browser.