Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:28

0001 #!/bin/bash -x
0002 
0003 LOCAL_TEST_DIR="${CMSSW_BASE}/src/FWCore/Framework/test"
0004 source "${LOCAL_TEST_DIR}/help_cmsRun_tests.sh"
0005 
0006 # test different config_file suffix (not .py)
0007 cp ${LOCAL_TEST_DIR}/test_argparse.py test_argparse.notpy
0008 doTest 1 "cmsRun -n 1 test_argparse.notpy" "" "TestArgParse"
0009 
0010 # test dash in config_file name
0011 cp -- ${LOCAL_TEST_DIR}/test_argparse.py -test_argparse.py
0012 doTest 2 "cmsRun -n 1 -- -test_argparse.py" "" "TestArgParse"
0013 
0014 # do these manually because quote nesting becomes a nightmare / perhaps actually impossible
0015 
0016 # test config as command line input
0017 TEST=3
0018 LOG="log_test$TEST.log"
0019 CONFIG_INPUT="import FWCore.ParameterSet.Config as cms; process = cms.Process('Test'); process.source=cms.Source('EmptySource'); process.maxEvents.input=10; print('Test3')"
0020 cmsRun -c "$CONFIG_INPUT" >& $LOG || die "Test $TEST: failure running cmsRun -c \"${CONFIG_INPUT}\""
0021 (grep -qF "Test3" $LOG) || die "Test $TEST: incorrect output from cmsRun -c \"${CONFIG_INPUT}\""
0022 
0023 # test command line input + config_file
0024 TEST=4
0025 LOG="log_test$TEST.log"
0026 CONFIG_INPUT="import FWCore.ParameterSet.Config as cms; process = cms.Process('Test'); process.source=cms.Source('EmptySource'); process.maxEvents.input=10"
0027 cmsRun -c "$CONFIG_INPUT" ${LOCAL_TEST_DIR}/test_argparse.py >& $LOG && die "Test $TEST: no error from cmsRun -c \"${CONFIG_INPUT}\" ${LOCAL_TEST_DIR}/test_argparse.py"
0028 (grep -qF "cannot use '-c [command line input]' with 'config_file'" $LOG) || die "Test $TEST: incorrect output from cmsRun -c \"${CONFIG_INPUT}\" ${LOCAL_TEST_DIR}/test_argparse.py"