Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
larsclausen committed Dec 21, 2024
1 parent e3f943f commit f7d30f1
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,30 @@ static const char*my_tempfile(const char*str, FILE**fout)
return pathbuf;
}

#ifdef __MINGW32__
static int run_cmd(const char *cmd)
{
char *cmd2;
int len;
int rc;

len = strlen(cmd) + 3;
cmd2 = malloc(len);
rc = snprintf(cmd2, len, "\"%s\"", cmd);
if (rc < 0)
return rc;

system(cmd2);
free(cmd2);
}
#else
static int run_cmd(const char *cmd)
{
return system(cmd);
}

#endif

static int t_version_only(void)
{
int rc;
Expand All @@ -329,15 +353,15 @@ static int t_version_only(void)

fflush(0);
snprintf(tmp, sizeof tmp, "\"%s%civlpp\" -V", ivlpp_dir, sep);
rc = system(tmp);
rc = run_cmd(tmp);
if (rc != 0) {
fprintf(stderr, "Unable to get version from \"%s\"\n", tmp);
}

fflush(0);
snprintf(tmp, sizeof tmp, "\"%s%civl\" -V -C\"%s\" -C\"%s\"", base, sep,
iconfig_path, iconfig_common_path);
rc = system(tmp);
rc = run_cmd(tmp);
if (rc != 0) {
fprintf(stderr, "Unable to get version from \"%s\"\n", tmp);
}
Expand Down Expand Up @@ -388,7 +412,7 @@ static int t_preprocess_only(void)
if (verbose_flag)
printf("preprocess: %s\n", cmd);

rc = system(cmd);
rc = run_cmd(cmd);
remove(source_path);
free(source_path);

Expand Down Expand Up @@ -489,7 +513,7 @@ static int t_compile(void)
printf("translate: %s\n", cmd);


rc = system(cmd);
rc = run_cmd(cmd);
if ( ! getenv("IVERILOG_ICONFIG")) {
remove(source_path);
free(source_path);
Expand Down

0 comments on commit f7d30f1

Please sign in to comment.