Tests: Fix Ubuntu24.04 clang test issues, and enable action (#5824)
This commit is contained in:
parent
d31bce915c
commit
b54f897090
|
@ -96,7 +96,13 @@ jobs:
|
|||
- {os: ubuntu-24.04, compiler: {cc: gcc, cxx: g++}, reloc: 0, suite: dist-vlt-3}
|
||||
- {os: ubuntu-24.04, compiler: {cc: gcc, cxx: g++}, reloc: 0, suite: vltmt-0}
|
||||
- {os: ubuntu-24.04, compiler: {cc: gcc, cxx: g++}, reloc: 0, suite: vltmt-1}
|
||||
# Ubuntu 24.04 Clang - has problems
|
||||
# Ubuntu 24.04 Clang
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: dist-vlt-0}
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: dist-vlt-1}
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: dist-vlt-2}
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: dist-vlt-3}
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: vltmt-0}
|
||||
- {os: ubuntu-24.04, compiler: {cc: clang, cxx: clang++}, reloc: 0, suite: vltmt-1}
|
||||
# Ubuntu 22.04 GCC
|
||||
- {os: ubuntu-22.04, compiler: {cc: gcc, cxx: g++}, reloc: 0, suite: dist-vlt-0}
|
||||
- {os: ubuntu-22.04, compiler: {cc: gcc, cxx: g++}, reloc: 0, suite: dist-vlt-1}
|
||||
|
|
|
@ -23,6 +23,8 @@ import time
|
|||
from functools import lru_cache # Eventually use python 3.9's cache
|
||||
from pprint import pformat, pprint
|
||||
|
||||
import distro
|
||||
|
||||
if False: # pylint: disable=using-constant-test
|
||||
pprint(pformat("Ignored")) # Prevent unused warning
|
||||
|
||||
|
@ -140,10 +142,10 @@ class Capabilities:
|
|||
@staticproperty
|
||||
def cxx_version() -> str: # pylint: disable=no-method-argument
|
||||
if Capabilities._cached_cxx_version is None:
|
||||
Capabilities._cached_cxx_version = VtOs.run_capture(os.environ['MAKE'] + " -C " +
|
||||
os.environ['TEST_REGRESS'] +
|
||||
" -f Makefile print-cxx-version",
|
||||
check=False)
|
||||
Capabilities._cached_cxx_version = VtOs.run_capture(
|
||||
os.environ['MAKE'] + " --silent -C " + os.environ['TEST_REGRESS'] +
|
||||
" -f Makefile print-cxx-version",
|
||||
check=False)
|
||||
|
||||
return Capabilities._cached_cxx_version
|
||||
|
||||
|
@ -449,7 +451,7 @@ class Runner:
|
|||
else:
|
||||
error_msg = test.errors if test.errors else test.errors_keep_going
|
||||
test.oprint("FAILED: " + error_msg)
|
||||
makecmd = VtOs.getenv_def('VERILATOR_MAKE', os.environ['MAKE'] + "&&")
|
||||
makecmd = VtOs.getenv_def('VERILATOR_MAKE', os.environ['MAKE'] + " &&")
|
||||
upperdir = 'test_regress/' if re.search(r'test_regress', os.getcwd()) else ''
|
||||
self.fail_msgs.append("\t#" + test.soprint("%Error: " + error_msg) + "\t\t" + makecmd +
|
||||
" " + upperdir + test.py_filename + ' ' +
|
||||
|
@ -1238,6 +1240,13 @@ class VlTest:
|
|||
self.skip("Test requires Coroutines; ignore error since not available\n")
|
||||
return
|
||||
|
||||
if self.timing and self.sc and re.search(r'Ubuntu 24.04', distro.name(
|
||||
pretty=True)) and re.search(r'clang', self.cxx_version):
|
||||
self.skip(
|
||||
"Test requires SystemC and Coroutines; broken on Ubuntu 24.04 w/clang\n" +
|
||||
" OS=" + distro.name(pretty=True) + " CXX=" + self.cxx_version)
|
||||
return
|
||||
|
||||
if param['verilator_make_cmake'] and not self.have_cmake:
|
||||
self.skip(
|
||||
"Test requires CMake; ignore error since not available or version too old\n")
|
||||
|
|
|
@ -17,6 +17,9 @@ if not test.have_coroutines:
|
|||
if not test.have_cmake:
|
||||
test.skip("cmake is not installed")
|
||||
|
||||
if re.search(r'clang', test.cxx_version):
|
||||
test.skip("Known clang bug on ubuntu-24.04")
|
||||
|
||||
test.compile(verilator_flags2=["--timescale 10ns/1ns --main --timing"],
|
||||
verilator_make_gmake=False,
|
||||
verilator_make_cmake=True)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
@ -207,7 +208,9 @@ void _arr_iter_check(const char* name, int wordSize, const int* lows) {
|
|||
|
||||
void _arr_access_format_check(TestVpiHandle& reg_h, int wordSize, const int* lows,
|
||||
const char* octVal_s, PLI_INT32 format) {
|
||||
constexpr int MAX_SPANSIZE = 1024;
|
||||
const int spanSize = wordSize / 2;
|
||||
assert(spanSize <= MAX_SPANSIZE);
|
||||
s_vpi_value value_in;
|
||||
s_vpi_value value_out;
|
||||
s_vpi_error_info e;
|
||||
|
@ -226,14 +229,14 @@ void _arr_access_format_check(TestVpiHandle& reg_h, int wordSize, const int* low
|
|||
TestVpiHandle subreg_h = vpi_handle_by_index(reg_h, lows[2] + i);
|
||||
TEST_CHECK_NZ(subreg_h);
|
||||
|
||||
char octSpan_s[spanSize / 3 + 1];
|
||||
char octSpan_s[MAX_SPANSIZE / 3 + 1];
|
||||
strncpy(octSpan_s, &octVal_s[spanSize / 3 * (1 - i)], spanSize / 3);
|
||||
octSpan_s[spanSize / 3] = '\0';
|
||||
|
||||
uint64_t intVal;
|
||||
t_vpi_vecval vecVal[2];
|
||||
sscanf(octSpan_s, "%" SCNo64, &intVal);
|
||||
char strVal_s[spanSize + 1]; // max length of the string happens for binary
|
||||
char strVal_s[MAX_SPANSIZE + 1]; // max length of the string happens for binary
|
||||
|
||||
if (format == vpiIntVal) {
|
||||
value_in.value.integer = intVal;
|
||||
|
@ -257,7 +260,7 @@ void _arr_access_format_check(TestVpiHandle& reg_h, int wordSize, const int* low
|
|||
sprintf(strVal_s, "%0*" PRIx64, (spanSize + 3) / 4, intVal);
|
||||
value_in.value.str = strVal_s;
|
||||
} else if (format == vpiOctStrVal) {
|
||||
sprintf(strVal_s, "%" PRIo64, intVal);
|
||||
sprintf(strVal_s, "%0*" PRIo64, (spanSize + 2) / 3, intVal);
|
||||
value_in.value.str = strVal_s;
|
||||
} else if (format == vpiStringVal) {
|
||||
const int byteCount = (spanSize + 7) / 8;
|
||||
|
@ -305,17 +308,13 @@ void _arr_access_check(const char* name, int wordSize, const int* lows) {
|
|||
std::uniform_int_distribution<uint64_t> rand64(std::numeric_limits<uint64_t>::min(),
|
||||
std::numeric_limits<uint64_t>::max());
|
||||
|
||||
char octVal_s[wordSize / 3 + 1];
|
||||
constexpr int MAX_WORDSIZE = 128;
|
||||
assert(wordSize <= MAX_WORDSIZE);
|
||||
char octVal_s[MAX_WORDSIZE / 3 + 2];
|
||||
|
||||
// fill octVal_s with random octal digits
|
||||
if (wordSize < 64) {
|
||||
sprintf(octVal_s, "%0*" PRIo64, wordSize / 3,
|
||||
rand64(rng) % (static_cast<uint64_t>(1) << wordSize));
|
||||
} else {
|
||||
sprintf(octVal_s, "%0*" PRIo64, 63 / 3, rand64(rng));
|
||||
sprintf(octVal_s + 63 / 3, "%0*" PRIo64, (wordSize - 63) / 3,
|
||||
rand64(rng) % (static_cast<uint64_t>(1) << (wordSize - 63)));
|
||||
}
|
||||
octVal_s[0] = '0' + (rand64(rng) % (1ULL << ((((wordSize - 1) % 3) + 1))));
|
||||
for (int i = 1; i < (wordSize + 2) / 3; ++i) octVal_s[i] = '0' + (rand64(rng) % 8);
|
||||
octVal_s[(wordSize + 2) / 3] = '\0';
|
||||
|
||||
// Assume that reading/writing to the "flattened" packed register is already tested,
|
||||
// check only reading/writing to sub-regs and validate the flattened result.
|
||||
|
|
Loading…
Reference in New Issue