Closed mmajdoubi closed 9 years ago
Hello, This will be fixed with the next batch of updates. Thank you.
is there any quick code-fix or workaround that I use in the mean time?
Thanks in advance
Hello @mmajdoubi
Sure, add this is the code in RunnerClasses.py, in class TCRunPerl
, in function _eval
.
Replace the definition of text_head variable with this:
perl_config = '( ' + json.dumps(globs['CONFIG'])[1:-1] + ' )'
perl_props = '( ' + json.dumps(globs['PROPERTIES'])[1:-1].replace('": ', '" => ') + ' )'
text_head = r"""#!/usr/bin/perl
$STATUS_PASS = 0;
$STATUS_FAIL = 3;
$STATUS_SKIPPED = 4;
$STATUS_ABORTED = 5;
$STATUS_NOT_EXEC = 6;
$STATUS_TIMEOUT = 7;
$STATUS_INVALID = 8;
$EP = TWISTER_EP();
$SUT = TWISTER_SUT();
$USER = TWISTER_USER();
$SUITE_NAME = TWISTER_SUITE_NAME();
$FILE_NAME = TWISTER_FILE_NAME();
@CONFIG = %s;
%%PROPERTIES = %s;
""" % (perl_config, perl_props)
Don't forget to import json
at the beggining of the file.
The CONFIG is an array and PROPERTIES is a hash, I think. I don't know Perl that much.
Use this in your perl test:
print "Config arr: @CONFIG \n";
@pkeys = keys %PROPERTIES;
@pvals = values %PROPERTIES;
print "Properties keys: @pkeys \n";
print "Properties vals: @pvals \n";
The injection of PROPERTIES dictionary variable is missing in RunnerClasses.py for Perl scripts. See below for a snapshot of the code, only $EP $SUT $USER $SUITE_NAME $FILE_NAME variables are injected and are available for Perl. is there any other way how to make PROPERTIES dictionary available for Perl testcase?
client/executionprocess/RunnerClasses.py
Line 294
$STATUS_PASS = 0; $STATUS_FAIL = 3; $STATUS_SKIPPED = 4; $STATUS_ABORTED = 5; $STATUS_NOT_EXEC = 6; $STATUS_TIMEOUT = 7; $STATUS_INVALID = 8;
$EP = TWISTER_EP(); $SUT = TWISTER_SUT(); $USER = TWISTER_USER(); $SUITE_NAME = TWISTER_SUITE_NAME(); $FILE_NAME = TWISTER_FILE_NAME();
"""
Thanks in advance