Reply To: Is there a built-in way in OSVVM to detect build failure without parsing logs?

Why OSVVM™? Forums OSVVM Is there a built-in way in OSVVM to detect build failure without parsing logs? Reply To: Is there a built-in way in OSVVM to detect build failure without parsing logs?

#2862
Amine, Adel
Member

Hi Jim,

Thanks for the detailed explanation and references to the OSVVM settings.

I’ve built a CI framework using GitHub Actions, running ModelSim on an Ubuntu runner. I’ll publish the template once the framework is complete. In my setup:

Initialize OSVVM and build the library via build.pro (example included in the template):

library osvvm_example
analyze ../src/example.vhd

Build RunAllTests.pro:

library osvvm_example

analyze ../tb/TestCtrl_e.vhd
analyze ../tb/example_tb.vhd

RunTest ../tb/example_tb_SimpleTest.vhd
RunTest ../tb/example_tb_RandomTest.vhd

End of simulation: I quit ModelSim and run checkXML.tcl to parse the XML files in both the sim_build and sim_runalltests directories. Merges to main are allowed only if the simulation passes; otherwise, they are rejected.

package require tdom

# Get arguments
set xmlFile [lindex $argv 0]
set DEBUG   [lindex $argv 1]

# Read XML file
set fh [open $xmlFile r]
set xmlData [read $fh]
close $fh

if {$DEBUG} {
    puts "\033\[33mDEBUG\033\[0m .xml file found : $xmlFile\nParsing..."
}

# Parse XML using tdom
set doc  [dom parse $xmlData]
set root [$doc documentElement]  ;# <testsuites>

# Extract attributes
set errors   [$root getAttribute errors 0]
set failures [$root getAttribute failures 0]
set skipped  [$root getAttribute skipped 0]

if {$DEBUG} {
    puts "\033\[33mDEBUG\033\[0m errors=$errors, failures=$failures, skipped=$skipped"
}

# Print results
puts ".xml File: \033\[35m$xmlFile\033\[0m"

if {$errors != 0 || $failures != 0 || $skipped != 0} {
    puts "Build: \033\[31mFAILED\033\[0m, Errors: $errors, Failures: $failures, Skipped: $skipped"
    exit 1
} else {
    puts "Build: \033\[32mPASSED\033\[0m, Errors: $errors, Failures: $failures, Skipped: $skipped"
    exit 0
}

My main question is: how can I make ModelSim exit with an error code when a test fails, so that the GitHub Actions workflow correctly marks the CI run as failed?

I’ll review my current simulation script to ensure errors are propagated correctly to the CI tool and that the OSVVM variables are set appropriately. If I run into simulator-specific issues, I’ll share the exact commands so we can discuss adjustments for proper CI signaling.

Thanks again for your guidance!

Best regards,
Amine