Module Name: src Committed By: rillig Date: Wed Jun 28 17:53:21 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: check-expect.lua msg_351.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/check-expect.lua cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_351.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/check-expect.lua diff -u src/tests/usr.bin/xlint/lint1/check-expect.lua:1.2 src/tests/usr.bin/xlint/lint1/check-expect.lua:1.3 --- src/tests/usr.bin/xlint/lint1/check-expect.lua:1.2 Sun Jun 19 11:50:42 2022 +++ src/tests/usr.bin/xlint/lint1/check-expect.lua Wed Jun 28 17:53:21 2023 @@ -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 Index: src/tests/usr.bin/xlint/lint1/msg_351.c diff -u src/tests/usr.bin/xlint/lint1/msg_351.c:1.4 src/tests/usr.bin/xlint/lint1/msg_351.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_351.c:1.4 Tue Apr 25 19:00:57 2023 +++ src/tests/usr.bin/xlint/lint1/msg_351.c Wed Jun 28 17:53:21 2023 @@ -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;