File: run-tests

package info (click to toggle)
libvc 012-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 236 kB
  • sloc: ansic: 652; lex: 154; yacc: 131; sh: 28; makefile: 22
file content (47 lines) | stat: -rwxr-xr-x 828 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

### Exit immediately if a command exits with a non-zero status
set -e

### Get the directory of this script
CURDIR=$(dirname $0)

### Include and library flags.  The values of these variables can be
### overriden by the respective ones in the environment.
INC=${INC:--I ../src}
LIB=${LIB:-../src/.libs/libvc.a}

### Define Compiler
CC=${CC:-gcc}

### Test header inclusion
test_header_inclusion() {
    src=$(mktemp --suffix .c)
    cat <<EOF > $src
#include <vc.h>
EOF
    $CC -E $INC $src > /dev/null
    rm -f $src
}

### Test call to the function vc_new
test_vc_new() {
    src=$(mktemp --suffix .c)
    cat <<EOF > $src
#include <vc.h>

int
main ()
{
   vc_component *v;
   v = vc_new ();
}
EOF
    out=$(mktemp)
    $CC -o $out $INC $src $LIB
    $out
    rm -f $src $out
}

### Launch the unit tests
. shunit2