summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-06-28 17:53:21 +0000
committerrillig <rillig@NetBSD.org>2023-06-28 17:53:21 +0000
commit95e2bd0bb3dbb801e6753b5a6b5049bd3a7849ed (patch)
treef696d2eac0cfacdf589dead4f6f78e2b737b9a8f /tests
parentee5ddd03593831962c7f0dc7346171acc302fd74 (diff)
tests/lint: fix preprocessor line number validation
When running the tests via ATF, the filename was an absolute filename, while the preprocessing line in the test file uses a relative filename. These two didn't match.
Diffstat (limited to 'tests')
-rw-r--r--tests/usr.bin/xlint/lint1/check-expect.lua6
-rw-r--r--tests/usr.bin/xlint/lint1/msg_351.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/usr.bin/xlint/lint1/check-expect.lua b/tests/usr.bin/xlint/lint1/check-expect.lua
index 90de9b6487f..06d1df6b042 100644
--- a/tests/usr.bin/xlint/lint1/check-expect.lua
+++ b/tests/usr.bin/xlint/lint1/check-expect.lua
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.2 2022/06/19 11:50:42 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.3 2023/06/28 17:53:21 rillig Exp $
--[[
@@ -58,7 +58,7 @@ end
-- },
-- { "file.c(18)", "file.c(23)" }
local function load_c(fname)
-
+ local basename = fname:match("([^/]+)$") or fname
local lines = load_lines(fname)
if lines == nil then return nil, nil end
@@ -87,7 +87,7 @@ local function load_c(fname)
local ppl_lineno, ppl_fname = line:match("^#%s*(%d+)%s+\"([^\"]+)\"")
if ppl_lineno ~= nil then
- if ppl_fname == fname and tonumber(ppl_lineno) ~= phys_lineno + 1 then
+ if ppl_fname == basename and tonumber(ppl_lineno) ~= phys_lineno + 1 then
print_error("error: %s:%d: preprocessor line number must be %d",
fname, phys_lineno, phys_lineno + 1)
end
diff --git a/tests/usr.bin/xlint/lint1/msg_351.c b/tests/usr.bin/xlint/lint1/msg_351.c
index 3f59431f320..7b23376ec6e 100644
--- a/tests/usr.bin/xlint/lint1/msg_351.c
+++ b/tests/usr.bin/xlint/lint1/msg_351.c
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_351.c,v 1.4 2023/04/25 19:00:57 rillig Exp $ */
+/* $NetBSD: msg_351.c,v 1.5 2023/06/28 17:53:21 rillig Exp $ */
# 3 "msg_351.c"
// Test for message 351: missing%s header declaration for '%s' [351]
@@ -39,7 +39,7 @@ static int static_func_def(void);
int extern_func_decl(void);
extern int extern_func_decl_verbose(void);
-# 29 "msg_351.c" 2
+# 43 "msg_351.c" 2
/* expect+1: warning: static variable 'static_def' unused [226] */
static int static_def;
int external_def;