-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41643 from makortel/fixNumberOfThreadsTypeCheck_106x
[10_6_X] Make sure to report an error if process.options.numberOfThreads has wrong type
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
NAME=$1 | ||
VALUE=$2 | ||
|
||
function die { echo $1: status $2 ; echo === Log file === ; cat ${3:-/dev/null} ; echo === End log file === ; exit $2; } | ||
|
||
cmsRun ${LOCALTOP}/src/FWCore/Framework/test/test_wrongOptionsType_cfg.py -- --name=${NAME} --value="$VALUE" > ${NAME}.log 2>&1 && die "cmsRun for ${NAME} succeeded, should have failed" 1 ${NAME}.log | ||
grep -E "(The type in the configuration is incorrect)|(ValueError type of .* is expected to be .* but declared as)" ${NAME}.log > /dev/null || die "cmsRun for ${NAME} failed for other reason than incorrect configuration type" $? ${NAME}.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
import argparse | ||
import sys | ||
|
||
parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test wrong process.options parameter types') | ||
|
||
parser.add_argument("--name", help="Name of parameter", type=str) | ||
parser.add_argument("--value", help="Value of the parameter", type=str) | ||
|
||
argv = sys.argv[:] | ||
if '--' in argv: | ||
argv.remove("--") | ||
args, unknown = parser.parse_known_args(argv) | ||
|
||
process = cms.Process("TEST") | ||
process.source = cms.Source("EmptySource") | ||
|
||
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(2)) | ||
|
||
process.options = cms.untracked.PSet() | ||
setattr(process.options, args.name, eval(str(args.value))) |