source: trunk/base/tests/Makefile @ 65055

Last change on this file since 65055 was 59679, checked in by jmr@…, 11 years ago

get most of the tests working again

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