Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-17 01:47:23

0001 #!/bin/bash
0002 check_for_success() {
0003     "${@}" && echo -e "\n ---> Passed test of '${@}'\n\n" || exit 1
0004 }
0005 
0006 check_for_failure() {
0007     "${@}" && exit 1 || echo -e "\n ---> Passed test of '${@}'\n\n"
0008 }
0009 
0010 function die { echo $1: status $2; exit $2; }
0011 
0012 ########################################
0013 # Test help function
0014 ########################################
0015 check_for_success uploadConditions.py --help
0016 
0017 ########################################
0018 # Test wizard
0019 ########################################
0020 if test -f "BasicPayload_v0_ref.txt"; then
0021     rm -f BasicPayload_v0_ref.txt
0022 fi
0023 cat <<EOF >> BasicPayload_v0_ref.txt
0024 {
0025     "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", 
0026     "destinationTags": {
0027         "BasicPayload_v0": {}
0028     }, 
0029     "inputTag": "BasicPayload_v0", 
0030     "since": 1, 
0031     "userText": "uploadConditions unit test"
0032 }
0033 EOF
0034 
0035 echo "Content of the directory is:" `ls -lh . | grep db`
0036 echo -ne '\n\n'
0037 
0038 if test -f "BasicPayload_v0.txt"; then
0039    rm -f BasicPayload_v0.txt
0040 fi
0041 
0042 # this is expected to fail given lack of credentials
0043 check_for_failure uploadConditions.py BasicPayload_v0.db <<EOF
0044 y
0045 0
0046 oracle://cms_orcoff_prep/CMS_CONDITIONS
0047 1
0048 uploadConditions unit test
0049 BasicPayload_v0
0050 `echo -ne '\n'`
0051 y
0052 test
0053 test
0054 EOF
0055 
0056 # test that the metadata created with the wizard corresponds to the reference one
0057 diff -w BasicPayload_v0.txt BasicPayload_v0_ref.txt || die 'failed comparing metadata with reference' $?