~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to common/check.mak

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-02-04 14:42:30 UTC
  • Revision ID: james.westby@ubuntu.com-20060204144230-9ihvyas6lhgn81k1
Tags: upstream-0.9.9.2
ImportĀ upstreamĀ versionĀ 0.9.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
clean-local-check:
 
2
        for i in `find . -name ".libs" -type d`; do \
 
3
          rm -rf $$i; \
 
4
        done
 
5
 
 
6
if HAVE_VALGRIND
 
7
# hangs spectacularly on some machines, so let's not do this by default yet
 
8
check-valgrind:
 
9
        make valgrind
 
10
else
 
11
check-valgrind:
 
12
        @true
 
13
endif
 
14
 
 
15
LOOPS = 10
 
16
 
 
17
# run any given test by running make test.check
 
18
# if the test fails, run it again at at least debug level 2
 
19
%.check: %
 
20
        @$(TESTS_ENVIRONMENT)                                   \
 
21
        CK_DEFAULT_TIMEOUT=20                                   \
 
22
        $* ||                                                   \
 
23
        $(TESTS_ENVIRONMENT)                                    \
 
24
        GST_DEBUG=$$GST_DEBUG,*:2                               \
 
25
        CK_DEFAULT_TIMEOUT=20                                   \
 
26
        $*
 
27
 
 
28
# run any given test in a loop
 
29
%.torture: %
 
30
        @for i in `seq 1 $(LOOPS)`; do                          \
 
31
        $(TESTS_ENVIRONMENT)                                    \
 
32
        CK_DEFAULT_TIMEOUT=20                                   \
 
33
        $*; done
 
34
 
 
35
# run any given test in an infinite loop
 
36
%.forever: %
 
37
        @while true; do                                         \
 
38
        $(TESTS_ENVIRONMENT)                                    \
 
39
        CK_DEFAULT_TIMEOUT=20                                   \
 
40
        $* || break; done
 
41
 
 
42
# valgrind any given test by running make test.valgrind
 
43
%.valgrind: %
 
44
        $(TESTS_ENVIRONMENT)                                    \
 
45
        CK_DEFAULT_TIMEOUT=60                                   \
 
46
        libtool --mode=execute                                  \
 
47
        $(VALGRIND_PATH) -q --suppressions=$(SUPPRESSIONS)      \
 
48
        --tool=memcheck --leak-check=full --trace-children=yes  \
 
49
        --leak-resolution=high --num-callers=20                 \
 
50
        $* 2>&1 | tee valgrind.log
 
51
        @if grep "==" valgrind.log > /dev/null 2>&1; then       \
 
52
            rm valgrind.log;                                    \
 
53
            exit 1;                                             \
 
54
        fi
 
55
        @rm valgrind.log
 
56
 
 
57
# valgrind any given test until failure by running make test.valgrind-forever
 
58
%.valgrind-forever: %
 
59
        @while make $*.valgrind; do                             \
 
60
          true; done
 
61
 
 
62
# gdb any given test by running make test.gdb
 
63
%.gdb: %
 
64
        $(TESTS_ENVIRONMENT)                                    \
 
65
        CK_FORK=no                                              \
 
66
        libtool --mode=execute                                  \
 
67
        gdb $*
 
68
 
 
69
# torture tests
 
70
torture: $(TESTS)
 
71
        -rm test-registry.xml
 
72
        @echo "Torturing tests ..."
 
73
        for i in `seq 1 $(LOOPS)`; do                           \
 
74
                make check ||                                   \
 
75
                (echo "Failure after $$i runs"; exit 1) ||      \
 
76
                exit 1;                                         \
 
77
        done
 
78
        @banner="All $(LOOPS) loops passed";                    \
 
79
        dashes=`echo "$$banner" | sed s/./=/g`;                 \
 
80
        echo $$dashes; echo $$banner; echo $$dashes
 
81
 
 
82
# forever tests
 
83
forever: $(TESTS)
 
84
        -rm test-registry.xml
 
85
        @echo "Forever tests ..."
 
86
        while true; do                                          \
 
87
                make check ||                                   \
 
88
                (echo "Failure"; exit 1) ||                     \
 
89
                exit 1;                                         \
 
90
        done
 
91
 
 
92
# valgrind all tests
 
93
valgrind: $(TESTS)
 
94
        @echo "Valgrinding tests ..."
 
95
        @failed=0;                                                      \
 
96
        for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
 
97
                make $$t.valgrind;                                      \
 
98
                if test "$$?" -ne 0; then                               \
 
99
                        echo "Valgrind error for test $$t";             \
 
100
                        failed=`expr $$failed + 1`;                     \
 
101
                        whicht="$$whicht $$t";                          \
 
102
                fi;                                                     \
 
103
        done;                                                           \
 
104
        if test "$$failed" -ne 0; then                                  \
 
105
                echo "$$failed tests had leaks or errors under valgrind:";      \
 
106
                echo "$$whicht";                                        \
 
107
                false;                                                  \
 
108
        fi
 
109
 
 
110
help:
 
111
        @echo "make check                         -- run all checks"
 
112
        @echo "make torture                       -- run all checks $(LOOPS) times"
 
113
        @echo "make (dir)/(test).check            -- run the given check once"
 
114
        @echo "make (dir)/(test).forever          -- run the given check forever"
 
115
        @echo "make (dir)/(test).torture          -- run the given check $(LOOPS) times"
 
116
        @echo
 
117
        @echo "make (dir)/(test).gdb              -- start up gdb for the given test"
 
118
        @echo
 
119
        @echo "make valgrind                      -- valgrind all tests"
 
120
        @echo "make (dir)/(test).valgrind         -- valgrind the given test"
 
121
        @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"