[med-svn] [Git][med-team/fsm-lite][master] Added a start to autopkgtest framework

Andreas Tille (@tille) gitlab at salsa.debian.org
Mon Dec 20 16:10:47 GMT 2021



Andreas Tille pushed to branch master at Debian Med / fsm-lite


Commits:
539ada1b by Lance Lin at 2021-12-20T20:07:08+07:00
Added a start to autopkgtest framework

- - - - -


2 changed files:

- + debian/tests/control
- + debian/tests/run-unit-test


Changes:

=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: @
+Restrictions: allow-stderr


=====================================
debian/tests/run-unit-test
=====================================
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+# Author: Lance Lin <LQi254 at protonmail.com>
+# Date: 20 December 2021
+# File: run-unit-test
+# Purpose: run a simple-unit test for the fsm-lite package
+#
+# Details:
+# Use a publicly accessible .fasta file format example. There are others, but they quite large (>30MB)
+#
+# Execute fsm-lite on the sample data and verify the resulting generated files are the correct length
+#
+# Verify the two ouptut is correct:
+# tmp.meta should look like: "testfile	1508	", which is {inputFileName, filesize}
+# tmp.tmp will have the sequencing and should be 1508 bytes in length, as reported by tmp.meta
+
+set -e
+
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+echo "run-unit-test: generating data"
+
+# FASTA format file from "UT Southwestern Medical Center"
+# URL: http://prodata.swmed.edu/promals/info/fasta_format_file_example.htm
+# Website title: Fasta format file example
+# Date accessed: 20 December 2021
+cat <<EOF > testfile.fasta
+>seq0
+FQTWEEFSRAAEKLYLADPMKVRVVLKYRHVDGNLCIKVTDDLVCLVYRTDQAQDVKKIEKF
+>seq1
+KYRTWEEFTRAAEKLYQADPMKVRVVLKYRHCDGNLCIKVTDDVVCLLYRTDQAQDVKKIEKFHSQLMRLME LKVTDNKECLKFKTDQAQEAKKMEKLNNIFFTLM
+>seq2
+EEYQTWEEFARAAEKLYLTDPMKVRVVLKYRHCDGNLCMKVTDDAVCLQYKTDQAQDVKKVEKLHGK
+>seq3
+MYQVWEEFSRAVEKLYLTDPMKVRVVLKYRHCDGNLCIKVTDNSVCLQYKTDQAQDVK
+>seq4
+EEFSRAVEKLYLTDPMKVRVVLKYRHCDGNLCIKVTDNSVVSYEMRLFGVQKDNFALEHSLL
+>seq5
+SWEEFAKAAEVLYLEDPMKCRMCTKYRHVDHKLVVKLTDNHTVLKYVTDMAQDVKKIEKLTTLLMR
+>seq6
+FTNWEEFAKAAERLHSANPEKCRFVTKYNHTKGELVLKLTDDVVCLQYSTNQLQDVKKLEKLSSTLLRSI
+>seq7
+SWEEFVERSVQLFRGDPNATRYVMKYRHCEGKLVLKVTDDRECLKFKTDQAQDAKKMEKLNNIFF
+>seq8
+SWDEFVDRSVQLFRADPESTRYVMKYRHCDGKLVLKVTDNKECLKFKTDQAQEAKKMEKLNNIFFTLM
+>seq9
+KNWEDFEIAAENMYMANPQNCRYTMKYVHSKGHILLKMSDNVKCVQYRAENMPDLKK
+>seq10
+FDSWDEFVSKSVELFRNHPDTTRYVVKYRHCEGKLVLKVTDNHECLKFKTDQAQDAKKMEK
+EOF
+
+
+echo "run-unit-test: generating test input list file"
+cat <<EOF > input.list
+testfile $WORKDIR/testfile.fasta
+EOF
+
+echo "run-unit-test: running fsm-lite"
+fsm-lite -l input.list -t tmp | gzip - > output.txt.gz
+
+echo "run-unit-test: verifying output"
+
+# Output in tmp.meta should contain "1508", the file size/output of tmp.tmp in bytes
+# The test will capture the file size from tmp.meta and compare the output file length
+fileSizeMeta=$(cat tmp.meta | cut -f2)
+
+# Check file size of tmp.tmp matches what is reported by tmp.meta
+fileSize=$(du -b tmp.tmp | cut -f1)
+
+if [[ "$fileSize" -eq "$metaFileSize" ]]
+then
+	echo "run-unit-test: Failure - output file size does not match expected: $fileSize (generated) instead of $fileSizeMeta (expected)"
+	exit 1
+fi



View it on GitLab: https://salsa.debian.org/med-team/fsm-lite/-/commit/539ada1b52b4eb9e8d6458de7ba785a992fdc48c

-- 
View it on GitLab: https://salsa.debian.org/med-team/fsm-lite/-/commit/539ada1b52b4eb9e8d6458de7ba785a992fdc48c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20211220/e98b90e5/attachment-0001.htm>


More information about the debian-med-commit mailing list