File: buildAndSimpleRun

package info (click to toggle)
sumalibs 1.0.36-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 412 kB
  • sloc: ansic: 3,154; lex: 174; sh: 45; makefile: 26
file content (48 lines) | stat: -rw-r--r-- 832 bytes parent folder | download | duplicates (2)
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
48
#!/bin/sh
# autopkgtest check: build and run a program against sumalibs. We check that 
# it builds and that it behaves well on a very simple reading exercise.
# (C) 2020 Pierre Gruet.
# Author: Pierre Gruet <pgt@debian.org>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

cat <<EOF > test.fasta
>SEQ1
ACGATCGCACGCATCGTCAG
>SEQ2
ACGTAGCTAGCA
EOF

cat <<EOF > main.c
#include <stdio.h>
#include <libfasta/sequence.h>

int main()
{
        fastaSeqCount n;
        n=seq_readAllSeq2("test.fasta", 1, 1);
        printf("%d sequences are read\n", n.count);
        
        return 0;
}
EOF

gcc -c -o main.o main.c
gcc -o testPrg main.o -lsuma

echo "Build done"

if [ -x testPrg ]; then
  ./testPrg |
  sed -n 's/.sequences.*//p' |
  grep "2"
  
  if [ $? -ne 0 ]; then
    exit 1
  fi
fi