Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gen-tests
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ class Test:
self.tags = [f"Branch: '{branch}'"]

def render(self):
return self.tmpl.render(verilator_root=self.root, suite=self.suite, test=self.name, tags=' '.join(self.tags))
uvm_cookbook = os.path.abspath(os.getenv('UVM_COOKBOOK', ''))
return self.tmpl.render(
verilator_root=self.root,
suite=self.suite,
test=self.name,
tags=' '.join(self.tags),
uvm_cookbook=uvm_cookbook)

def makedirs(self):
os.makedirs(f'out/{self.suite}/{self.name}', exist_ok=True)
Expand Down
12 changes: 4 additions & 8 deletions scripts/test-cookbook
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#!/bin/bash
set -e

if [[ -z "${UVM_COOKBOOK}" ]]; then
echo "Error: UVM_COOKBOOK environment variable is not set."
echo "Set it to point to the directory containing UVM Cookbook examples."
fi

if [[ -z "$1" ]]; then
echo "Usage: $0 <test-directory>"
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then
echo "Usage: $0 <test-directory> <verilator-root> <uvm-cookbook>"
exit 1
fi

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

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

source "$TEST_CONFIG"
TEST_DIR="$REPO_DIR/third-party/$UVM_COOKBOOK/uvm_code_examples/$TEST_NAME"
TEST_DIR="$UVM_COOKBOOK/uvm_code_examples/$TEST_NAME"

# Compose flags
DISABLED_WARNINGS="$GLOBAL_DISABLED_WARNINGS $TEST_DISABLED_WARNINGS"
Expand Down
2 changes: 1 addition & 1 deletion templates/uvm-cookbook.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ test }}
[Tags] {{ tags }}
${result} = Run Process scripts/test-cookbook {{ test }} {{ verilator_root }} stdout=out/{{ suite }}/{{ test }}/stdout.log stderr=STDOUT
${result} = Run Process scripts/test-cookbook {{ test }} {{ verilator_root }} {{ uvm_cookbook }} stdout=out/{{ suite }}/{{ test }}/stdout.log stderr=STDOUT
Log ${result.stdout}
Run Keyword If ${result.rc}==-15 Set Tags Timeout
Should Be Equal As Integers ${result.rc} 0
Expand Down