Skip to content

Commit

Permalink
Fix test failures on Windows and with address sanitiser
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Oct 10, 2021
1 parent 2d732c0 commit 2a40922
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ static LLVMValueRef llvm_void_cast(LLVMValueRef ptr)

static LLVMValueRef llvm_sizeof(LLVMTypeRef type)
{
return LLVMBuildIntCast(builder, LLVMSizeOf(type),
LLVMInt32Type(), "");
LLVMTargetDataRef td = LLVMGetModuleDataLayout(module);
return llvm_int32(LLVMABISizeOfType(td, type));
}

static LLVMValueRef llvm_fn(const char *name)
Expand Down
2 changes: 1 addition & 1 deletion test/regress/testlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,4 @@ issue423 normal
driver6 normal
driver7 fail,gold
issue428 normal
protected5 normal,2000
protected5 normal,2000,!windows
14 changes: 11 additions & 3 deletions test/run_regr.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#define F_VHPI (1 << 3)
#define F_2008 (1 << 4)
#define F_2000 (1 << 5)
// Unused (1 << 6)
#define F_NOTWIN (1 << 6)
#define F_COVER (1 << 7)
#define F_GENERIC (1 << 8)
#define F_RELAX (1 << 9)
Expand Down Expand Up @@ -307,6 +307,8 @@ static bool parse_test_list(int argc, char **argv)
test->flags |= F_2000;
else if (strcmp(opt, "vhpi") == 0)
test->flags |= F_VHPI;
else if (strcmp(opt, "!windows") == 0)
test->flags |= F_NOTWIN;
else if (strncmp(opt, "O", 1) == 0) {
if (sscanf(opt + 1, "%u", &(test->olevel)) != 1) {
fprintf(stderr, "Error on testlist line %d: invalid "
Expand Down Expand Up @@ -523,15 +525,21 @@ static bool run_test(test_t *test)

printf("%15s : ", test->name);

int skip = 0;
#ifndef ENABLE_VHPI
if (test->flags & F_VHPI) {
skip |= (test->flags & F_VHPI);
#endif
#if defined __MINGW32__ || defined __CYGWIN__
skip |= (test->flags & F_NOTWIN);
#endif

if (skip) {
set_attr(ANSI_FG_CYAN);
printf("skipped\n");
set_attr(ANSI_RESET);
result = true;
goto out_chdir;
}
#endif

if ((test->flags & F_CLEAN) && dir_exists("work")) {
if (system("rm -r work") != 0) {
Expand Down

0 comments on commit 2a40922

Please sign in to comment.