File: run-unit-test

package info (click to toggle)
bppsuite 2.4.1-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,116 kB
  • sloc: cpp: 3,867; sh: 65; makefile: 5
file content (85 lines) | stat: -rw-r--r-- 3,105 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -e

pkg=bppsuite
ARCH=$(dpkg --print-architecture)

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ]; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  # Double quote below to expand the temporary directory variable now versus
  # later is on purpose.
  # shellcheck disable=SC2064
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

cp -a /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"

gunzip -r *

run_test() {
  # $1: test number 
  # $2: command
  # $3: path to file
  # $4: filename
  # $5: outfile
  # $6: reference
  echo -e "\e[93m\e[1mTest $1\e[0m"
  cd $3
  $2 param=$4
  if [ "$?" -ne "0" ]; then
    echo -e "\e[31m\e[1mTest $1 could not be run.\e[0m"
    exit 1
  fi
  # discard digits after the fourth decimal place
  # in outfile and refence both
  sed -e "s/\([0-9]\.[0-9]\{4\}\)[0-9]\+/\1/g" < $5 > $5.approx
  sed -e "s/\([0-9]\.[0-9]\{4\}\)[0-9]\+/\1/g" < $6 > $6.approx
  if [ $1 -eq 5 -a "$ARCH" = "arm64" ] ; then
    echo "Test $1 is known to diverge on $ARCH which is accepted here"
  else
    diff $5.approx $6.approx --suppress-common-lines
    if [ "$?" -ne "0" ]; then
      echo -e "\e[31m\e[1mOutput did not match the reference.\e[0m"
      exit 1
    fi
    echo -e "\e[92m\e[1mPassed\e[0m"
  fi
}

run_test 1 bppml MaximumLikelihood/Codons/BranchModel ML.bpp lysozymeLarge.ML.dnd ../../../ref/branch-lysozymeLarge.ML.dnd

run_test 2 bppml ../CladeModel ML.bpp lysozymeLarge.ML.dnd ../../../ref/clade-lysozymeLarge.ML.dnd

run_test 3 bppml ../M0 ML.bpp lysozymeLarge.ML.dnd ../../../ref/m0-lysozymeLarge.ML.dnd

run_test 4 bppml ../../Nucleotides/Homogeneous ML.bpp LSU.ML.dnd ../../../ref/LSU.ML.dnd

run_test 5 bppml ../../Proteins/Homogeneous ML.bpp Myo.ML.dnd ../../../ref/Myo.ML.dnd

run_test 6 bppseqgen ../../../SequenceSimulation/Homogeneous "SeqGen.bpp --seed=5" LSUSim.fasta ../../ref/Homogeneous-LSUSim.fasta

run_test 7 bppseqgen ../HomogeneousCovarion "SeqGen.bpp --seed=5" LSUSim.fasta ../../ref/HomogeneousCovarion-LSUSim.fasta

run_test 8 bppseqgen ../NonHomogeneous "SeqGen.bpp --seed=5" LSUSim.fasta ../../ref/NonHomogeneous-LSUSim.fasta

run_test 9 bppseqgen ../WithSiteSpecificSettings "SeqGen.bpp --seed=5" LSUSim.fasta ../../ref/WithSiteSpecificSettings-LSUSim.fasta

run_test 10 bppdist ../../Distance Dist.bpp LSU.mat ../ref/dist-LSU.mat

run_test 11 bpppars ../Parsimony Pars.bpp Pars.bpp Pars.bpp
# No comparison since output appears to be different everytime
# and no seed parameter can be provided
# comparing imput file against itself to obey function rules

run_test 12 bppreroot ../ReRooting ReRoot.bpp treeList2_rooted.dnd ../ref/treeList2_rooted.dnd

run_test 13 bppseqman ../SequenceManipulation SeqMan.bpp LSU.fas ../ref/seqman-LSU.fas

run_test 14 bppalnscore ../AlignmentScoring AlnScores.bpp HIV1_REF_2010_gag.scores.txt ../ref/HIV1_REF_2010_gag.scores.txt

run_test 15 bpppopstats ../PopStats PopStatsCodonSites.bpp alignment.codons.csv ../ref/popstats-alignment.codons.csv

run_test 16 bpptreedraw ../Drawing TreeDraw.bpp LSU.svg ../ref/treedraw-LSU.svg