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 25, 2024
1 parent e3f943f commit ea5496e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
34 changes: 30 additions & 4 deletions driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,32 @@ 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) + 13;
cmd2 = malloc(len);
rc = snprintf(cmd2, len, "cmd /S /C \"%s\"", cmd);
if (rc < 0)
return rc;

rc = system(cmd2);
free(cmd2);

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

#endif

static int t_version_only(void)
{
int rc;
Expand All @@ -329,15 +355,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 +414,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 +515,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
6 changes: 5 additions & 1 deletion ivlpp/lexor.lex
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,7 @@ static void open_input_file(struct include_stack_t*isp)
return;
}

size_t cmdlen = strlen(vhdlpp_path);
size_t cmdlen = strlen(vhdlpp_path) + 12;
cmdlen += strlen(isp->path);
cmdlen += 8+strlen(vhdlpp_work);

Expand All @@ -2130,7 +2130,11 @@ static void open_input_file(struct include_stack_t*isp)
cmdlen += liblen;

char*cmd = malloc(cmdlen);
#ifdef __MINGW32__
snprintf(cmd, cmdlen, "cmd /S /C \"%s -w\"%s\"%s %s\"", vhdlpp_path, vhdlpp_work, libs, isp->path);
#else
snprintf(cmd, cmdlen, "%s -w\"%s\"%s %s", vhdlpp_path, vhdlpp_work, libs, isp->path);
#endif

if (verbose_flag) fprintf(stderr, "Invoke vhdlpp: %s\n", cmd);

Expand Down

0 comments on commit ea5496e

Please sign in to comment.