I am trying to set configuration by using command line option:
+uvm_set_config_int= \*,path_index,1
In sequence, in body task I am looking for the value :
if (!uvm_config_db#(int)::get(null, "", "path_index",i)) begin
end
Value is not found.
If instead of command line option , I am setting the value in the build phase of the test:
uvm_config_db #(int)::set(null, "*", "path_index", 1)
Value is found by sequence.
I checked UVM configuration viewer and it looks like in both cases scope pattern is a same
Please advise
Grisha
Try uvm_bitstream_t instead of int:
if (!uvm_config_db#(uvm_bitstream_t)::get(null, "", "path_index",i)) begin
end
Related
Got quite a head-scratcher....
I'm using the VBScript function REPLACE to replace spaces in a decrypted field from a MSSQL DB with "/".
But the REPLACE function isn't "seeing" the spaces.
For example, if I run any one of the following, where the decrypted value of the field "ITF_U_ClientName_Denc" is "Johnny Carson":
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc")," ","/")
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc")," ","/")
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc"),"Chr(160)","/")
REPLACE(CSTR(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc"))," ","/")
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc")," ","/",1,-1,1)
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc")," ","/",1,-1,0)
The returned value is "Johnny Carson" (space not replaced with /)
The issue seems to be exclusively with spaces, because when I run this:
REPLACE(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc"),"a","/")
I get "Johnny C/rson".
Also, the issue seems to be exclusively with spaces in the decrypted value, because when I run this:
REPLACE("Johnny Carson"," ","/")
Of course, the returned value is "Johnny/Carson".
I have checked what is being written to the source of the page and it is simply "Johnny Carson" with no encoding or special characters.
I have also tried the SPLIT function to see if it would "see" the space, but it doesn't.
Finally, thanks to a helpful comment, I tried VBS REGEX searching for \s.
Set regExp = New RegExp
regExp.IgnoreCase = True
regExp.Global = True
regExp.Pattern = "\s" 'Add here every character you don't consider as special character
strProcessed = regExp.Replace(ITF_U_Ledger.Fields("ITF_U_ClientName_Denc"), "?")
Unfortunately, strProcessed retruns "Johnny Carson" (ie. spaces not detected/removed).
If I replace regExp.Pattern = "a", strProcessed returns "Johnny C?rson".
Many thanks for your help!!
As we found, the right character code is 160, and that did the trick:
replace(..., ChrW(160), "...")
This seems to be data specific and, additionally, as an alternative you can try to get same encoding of the source script (i.e. save with Save As with Encoding), or convert received database value into a different target encoding.
I am trying to place my snowflakes into git repository. Some of the part are environment specific, like
use schema analytics_dev ### I will have to change this while deploying to qa and stuff.
I was thinking if could replace these with variable like this
set env='dev'
use schema analytics+$env
But this an error "SQL compilation error: syntax error line 1 at position 20 unexpected '+'."
How do I achieve this functionality?
Here's a way, to append vars, and use as an identifier:
set env = 'dev';
set analytics_schema = 'analytics' || $env;
use schema identifier($analytics_schema);
A couple of options here:
set (min, max)=(40, 70);
select $min;
And this:
set var_artist_name ='Jackson Browne';
select getvariable('var_artist_name');
and more here:
https://docs.snowflake.com/en/sql-reference/session-variables.html
I need to do the following:
Read a .csv file into a variable. Csv file is having one single row with a string like (110,111,112,113,114)
Using this String variable, split the content on the basis of a comma",".
What I have done:
I have added a Thread Group
2a. Added a user defined variable 'Config Element'.
2b. Added a variable named 'issueIds' having value ${__FileToString(D:\TestCasesId.csv,,issueIds)}
3a. Now I added a JSR223 Sampler with the following code:
String lineItems1 = ${issueIds};
log.info(lineItems1);
3b. Executing this give the following error:
Response code:500
Response message:javax.script.ScriptException: In file: inline evaluation of: ``String lineItems1 = 114660,114661,114662,114663; log.info(lineItems1); ;'' Encountered "114661" at line 1, column 28.
in inline evaluation of: ``String lineItems1 = 114660,114661,114662,114663; log.info(lineItems1); ;'' at line number 1
4a. Added a BeanShell Sampler with the following script:
String lineItems2 = ${issueIds};
String[] lineItems2Arr = lineItems2.split(",");
log.info(lineItems2);
log.info(lineItems2Arr[0]);
4b. Executing this give the following error:
Response code:500
Response message:org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: ``String lineItems2 = 114660,114661,114662,114663; String[] lineItems2Arr = lineIt . . . '' Encountered "114661" at line 1, column 28.
What am i doing wrong?
You are doing 2 things wrong:
Inlining JMeter Functions or Variables into scripting elements is not recommended, you should be using vars shorthand to JMeterVariables class instance instead like:
String lineItems1 = vars.get("issueIds");
Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting therefore consider choosing groovy from the language drop-down
Groovy has much better performance comparing to Beanshell, it supports all modern Java SDK features and provides some syntax sugar on top of it, check out Apache Groovy - Why and How You Should Use It article for more details.
In case amount of comma separated fields is the same for all used csv files, you can consider using 'CSV Data Set Config' instead of manual splitting. In that case you will have a separate variable for each column in the csv, e.g.
id1,id2,id3,id4,id5
110,111,112,113,114
I want to define an nginx variable, set its value during a request, and use the variable inside a log format.
I am currently implementing a custom module in C (not interested in LUA at the moment).
Desired flow:
1. configure new log format: log_format my_format '$my_var1'; (nginx.conf)
2. configure new access log using that format: access_log /tmp/out my_format (nginx.conf)
3. set value during request handler, function from the following type:
typedef ngx_int_t (*ngx_http_handler_pt)(ngx_http_request_t *r);
Current flow:
1. Set variable to an initial value: set $my_var1 'empty_value'; (nginx.conf)
2. Find variable by index with ngx_http_get_flushed_variable(r, index)
3. Change variable value by assigning to data field.
When I print my variable to the debug log, I see the variable is set correctly to the changed value. However, the log module outputs the initial variable value instead of the changed value to the custom access log.
Can someone point me to what am I missing here?
Should I use ngx_http_add_variable function or use script compile /complex ?
short snippet from the current flow described above:
ngx_http_variable_value_t *v;
v = ngx_http_get_flushed_variable(r, ale_srv_cf->output_variable_index);
// ... error handling if not found ....
v->data = new_value;
v->len = new_value_length;
I have some forces (interface to dut) in my tb_top file.
For example:
// rx forces and assignments
assign rx_vif.chind2 = dut.rx_fe.chind2;
initial begin
force dut.rx_fe.x = rx_vif.x;
end
end
I want to execute above only if the rx_agent is active.
For this I have to get the rx_agent_config object to the tb_top like this:
if(!uvm_config_db #(rx_agent_config)::get(this, "", "db_rx_agent_config", m_rx_cfg)) begin
`uvm_error("top", "rx_agent_config not found")
end//if
THhe code for set:
uvm_config_db #(rx_agent_config)::set(this, "*", "db_rx_agent_config", m_cfg.m_rx_agent_cfg);
What should I write instead of this (in the get function)?
Supposed that your component name is "comp" in ENV, and the env is named "env" in the uvm_test, so in test bench top module, you should use below code to get the configuration handle
uvm_config_db#(rx_agent_cfg)::get(null, "uvm_test_top.env.comp", "db_rx_agent_cfg", rx_cfg);
Because the earliest time you could set "rx_agent_cfg" in the uvm_config_db is 0 time in build_phase, so it is safe to do get after a #0 delay in the initial block.