Skip to content

Commit fd63fdb

Browse files
authored
Merge pull request #852 from antmicro/fix-cookbook-path
Fix UVM Cookbook path handling
2 parents 3cc1899 + 2ae09c0 commit fd63fdb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

gen-tests

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ class Test:
4242
self.tags = [f"Branch: '{branch}'"]
4343

4444
def render(self):
45-
return self.tmpl.render(verilator_root=self.root, suite=self.suite, test=self.name, tags=' '.join(self.tags))
45+
uvm_cookbook = os.path.abspath(os.getenv('UVM_COOKBOOK', ''))
46+
return self.tmpl.render(
47+
verilator_root=self.root,
48+
suite=self.suite,
49+
test=self.name,
50+
tags=' '.join(self.tags),
51+
uvm_cookbook=uvm_cookbook)
4652

4753
def makedirs(self):
4854
os.makedirs(f'out/{self.suite}/{self.name}', exist_ok=True)

scripts/test-cookbook

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
#!/bin/bash
22
set -e
33

4-
if [[ -z "${UVM_COOKBOOK}" ]]; then
5-
echo "Error: UVM_COOKBOOK environment variable is not set."
6-
echo "Set it to point to the directory containing UVM Cookbook examples."
7-
fi
8-
9-
if [[ -z "$1" ]]; then
10-
echo "Usage: $0 <test-directory>"
4+
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then
5+
echo "Usage: $0 <test-directory> <verilator-root> <uvm-cookbook>"
116
exit 1
127
fi
138

@@ -17,6 +12,7 @@ TEST_CONFIG="$TEST_DIR/test_config.sh"
1712
UVM_DIR="$REPO_DIR/third-party/uvm-2017/src"
1813
UVM_DIR_1_2="$REPO_DIR/third-party/uvm-1.2/src"
1914
export VERILATOR_ROOT="$REPO_DIR/$2"
15+
export UVM_COOKBOOK="$3"
2016
export PATH="$VERILATOR_ROOT/bin:$PATH"
2117

2218
if [[ ! -f "$TEST_CONFIG" ]]; then
@@ -52,7 +48,7 @@ GLOBAL_VERILATOR_FLAGS="\
5248
$UVM_DIR/uvm_pkg.sv"
5349

5450
source "$TEST_CONFIG"
55-
TEST_DIR="$REPO_DIR/third-party/$UVM_COOKBOOK/uvm_code_examples/$TEST_NAME"
51+
TEST_DIR="$UVM_COOKBOOK/uvm_code_examples/$TEST_NAME"
5652

5753
# Compose flags
5854
DISABLED_WARNINGS="$GLOBAL_DISABLED_WARNINGS $TEST_DISABLED_WARNINGS"

templates/uvm-cookbook.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ test }}
22
[Tags] {{ tags }}
3-
${result} = Run Process scripts/test-cookbook {{ test }} {{ verilator_root }} stdout=out/{{ suite }}/{{ test }}/stdout.log stderr=STDOUT
3+
${result} = Run Process scripts/test-cookbook {{ test }} {{ verilator_root }} {{ uvm_cookbook }} stdout=out/{{ suite }}/{{ test }}/stdout.log stderr=STDOUT
44
Log ${result.stdout}
55
Run Keyword If ${result.rc}==-15 Set Tags Timeout
66
Should Be Equal As Integers ${result.rc} 0

0 commit comments

Comments
 (0)