Skip to content

Commit

Permalink
add a unit test for convertToRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Apr 18, 2024
1 parent 6e82cc8 commit 3f1e224
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HLTrigger/Tools/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- tests convertToRaw utility script -->
<test name="testConvertToRaw" command="testConvertToRaw.sh"/>
41 changes: 41 additions & 0 deletions HLTrigger/Tools/test/testConvertToRaw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Pass in name and status
function die {
printf "\n%s: status %s\n" "$1" "$2"
exit $2
}

check_for_success() {
"${@}" && echo -e "\n ---> Passed test of '${@}'\n\n" || exit 1
}

check_for_failure() {
"${@}" && exit 1 || echo -e "\n ---> Passed test of '${@}'\n\n"
}

echo "========================================"
echo "Testing convertToRaw in ${SCRAM_TEST_PATH}."
echo "----------------------------------------"
echo

echo "========================================"
echo "testing help function "
echo "----------------------------------------"
echo

convertToRaw --help || die "Failure running convertToRaw --help" $?

echo "========================================"
echo "testing successful conversion"
echo "----------------------------------------"
echo

check_for_success convertToRaw -f 1 -l=1 -v root://eoscms.cern.ch//eos/cms/store/data/Run2024C/EphemeralHLTPhysics0/RAW/v1/000/379/416/00000/9785dc6a-6211-4a80-a721-c1d4bb0e399b.root

echo "========================================"
echo "testing failing conversion"
echo "----------------------------------------"
echo

check_for_failure convertToRaw -f 1 -l=-1 -s rawDataRepacker root://eoscms.cern.ch//eos/cms/store/data/Run2024C/EphemeralHLTPhysics0/RAW/v1/000/379/416/00000/9785dc6a-6211-4a80-a721-c1d4bb0e399b.root

0 comments on commit 3f1e224

Please sign in to comment.