From 4d175fd5bd8be01ba45ebeacb6457b3bef884a43 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 23 Oct 2022 17:20:26 +0100 Subject: [PATCH] nvc --list does not describe contexts. Fixes #559 --- src/nvc.c | 2 ++ test/regress/cmdline4.sh | 29 +++++++++++++++++++++++++++++ test/regress/testlist.txt | 1 + test/run_regr.c | 22 ++++++++++++---------- 4 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 test/regress/cmdline4.sh diff --git a/src/nvc.c b/src/nvc.c index 3b937f2f..562de409 100644 --- a/src/nvc.c +++ b/src/nvc.c @@ -617,7 +617,9 @@ static void list_walk_fn(lib_t lib, ident_t ident, int kind, void *context) case T_ENTITY: pretty = "Entity"; break; case T_PACKAGE: pretty = "Package"; break; case T_PACK_BODY: pretty = "Package body"; break; + case T_PACK_INST: pretty = "Instantiated package"; break; case T_CONFIGURATION: pretty = "Configuration"; break; + case T_CONTEXT: pretty = "Context"; break; } printf("%-30s : %s\n", istr(ident), pretty); diff --git a/test/regress/cmdline4.sh b/test/regress/cmdline4.sh new file mode 100644 index 00000000..9cfb811b --- /dev/null +++ b/test/regress/cmdline4.sh @@ -0,0 +1,29 @@ +set -xe + +pwd +which nvc + +rm -rf tmpwork + +nvc --work=tmpwork --std=2008 -a - <out + +diff -u - out <d_name[0] != '.') { - snprintf(buf, sizeof(buf), "%s" DIR_SEP "%s", path, e->d_name); - if (e->d_type == DT_DIR && !remove_dir(buf)) - goto out_close; - else if (e->d_type == DT_REG && unlink(buf) < 0) - goto out_close; - } + if (strcmp(e->d_name, ".") == 0 || strcmp(e->d_name, "..") == 0) + continue; + + snprintf(buf, sizeof(buf), "%s" DIR_SEP "%s", path, e->d_name); + if (e->d_type == DT_DIR && !remove_dir(buf)) + goto out_close; + else if (e->d_type == DT_REG && unlink(buf) < 0) + goto out_close; } if (rmdir(path) < 0) @@ -639,7 +641,7 @@ static bool run_test(test_t *test) return false; } - FILE *outf = fopen("out", "w"); + FILE *outf = fopen(OUTFILE, "w"); if (outf == NULL) { set_attr(ANSI_FG_RED); printf("failed (error creating %s/out log file: %s)\n", @@ -737,7 +739,7 @@ static bool run_test(test_t *test) goto out_close; } - outf = freopen("out", "r", outf); + outf = freopen(OUTFILE, "r", outf); assert(outf != NULL); int lineno = 0; @@ -790,7 +792,7 @@ static bool run_test(test_t *test) set_attr(ANSI_RESET); char line[256]; - outf = freopen("out", "r", outf); + outf = freopen(OUTFILE, "r", outf); assert(outf != NULL); while (fgets(line, sizeof(line), outf)) fputs(line, stdout); -- 2.39.2