mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Changes to be committed:
modified: Makefile modified: obitests/obitools/obicount/test.sh
This commit is contained in:
6
Makefile
6
Makefile
@ -64,10 +64,8 @@ update-deps:
|
|||||||
test:
|
test:
|
||||||
$(GOTEST) ./...
|
$(GOTEST) ./...
|
||||||
|
|
||||||
obitests: obitools
|
obitests:
|
||||||
for t in $$(find obitests -name test.sh -print) ; do \
|
@find obitests -name test.sh -exec bash {} \;
|
||||||
bash $${t} ; \
|
|
||||||
done
|
|
||||||
|
|
||||||
man:
|
man:
|
||||||
make -C doc man
|
make -C doc man
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
|
|
||||||
#
|
#
|
||||||
# Here give the name of the test serie
|
# Here give the name of the test serie
|
||||||
@ -34,25 +34,37 @@ cleanup() {
|
|||||||
echo "========================================" 1>&2
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
rm -rf "$TMPDIR" # Suppress the temporary directory
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
echo "[$TEST_NAME @ $(date)] $*" 1>&2
|
echo "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT ERR SIGINT SIGTERM
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
echo "Testing $TEST_NAME..." 1>&2
|
log "Temporary directory is $TMPDIR"
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
######################################################################
|
||||||
####
|
####
|
||||||
#### Below are the tests
|
#### Below are the tests
|
||||||
####
|
####
|
||||||
#### Before each test :
|
#### Before each test :
|
||||||
#### - increment the variable ntest
|
#### - increment the variable ntest
|
||||||
####
|
####
|
||||||
#### Run the command as the condition of a if / then /else
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
####
|
####
|
||||||
#### then clause is executed on success of the command
|
#### then clause is executed on success of the command
|
||||||
#### - Write a success message using the log function
|
#### - Write a success message using the log function
|
||||||
@ -62,11 +74,12 @@ echo "Testing $TEST_NAME..." 1>&2
|
|||||||
#### - Write a failure message using the log function
|
#### - Write a failure message using the log function
|
||||||
#### - increment the variable failed
|
#### - increment the variable failed
|
||||||
####
|
####
|
||||||
#################################################
|
######################################################################
|
||||||
|
|
||||||
((ntest++))
|
((ntest++))
|
||||||
if obicount "${TEST_DIR}/wolf_F.fasta.gz" \
|
if obicount "${TEST_DIR}/wolf_F.fasta.gz" \
|
||||||
> "${TMPDIR}/wolf_F.fasta_count.csv" ; then
|
> "${TMPDIR}/wolf_F.fasta_count.csv"
|
||||||
|
then
|
||||||
log "OBICount: fasta reading OK"
|
log "OBICount: fasta reading OK"
|
||||||
((success++))
|
((success++))
|
||||||
else
|
else
|
||||||
@ -98,7 +111,7 @@ fi
|
|||||||
|
|
||||||
((ntest++))
|
((ntest++))
|
||||||
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
||||||
"${TMPDIR}/wolf_F.fastq_count.csv" > /dev/null
|
"${TMPDIR}/wolf_F.fastq_count.csv" > /dev/null
|
||||||
then
|
then
|
||||||
log "OBICount: counting on fasta and fastq are identical OK"
|
log "OBICount: counting on fasta and fastq are identical OK"
|
||||||
((success++))
|
((success++))
|
||||||
@ -109,7 +122,7 @@ fi
|
|||||||
|
|
||||||
((ntest++))
|
((ntest++))
|
||||||
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
||||||
"${TMPDIR}/wolf_F.csv_count.csv" > /dev/null
|
"${TMPDIR}/wolf_F.csv_count.csv" > /dev/null
|
||||||
then
|
then
|
||||||
log "OBICount: counting on fasta and csv are identical OK"
|
log "OBICount: counting on fasta and csv are identical OK"
|
||||||
((success++))
|
((success++))
|
||||||
@ -117,3 +130,12 @@ else
|
|||||||
log "OBICount: counting on fasta and csv are different failed"
|
log "OBICount: counting on fasta and csv are different failed"
|
||||||
((failed++))
|
((failed++))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
Reference in New Issue
Block a user