summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-10-31 01:48:33 -0400
committerPaul Smith <psmith@gnu.org>2022-10-31 02:23:04 -0400
commit38b19976f50af0c898030adcb86320bdfe52a159 (patch)
tree2f4d350dba8ac492185a28546535d9d5df71901c /tests
parent1dd52ab472e9dffa0cbdcdc68f196b64ce2abfc4 (diff)
downloadmake-git-38b19976f50af0c898030adcb86320bdfe52a159.tar.gz
Fix issues found by ASAN and Coverity
* tests/test_driver.pl: Preserve the LSAN_OPTIONS variable. * tests/scripts/targets/ONESHELL: Don't set a local variable. * tests/scripts/functions/let: Test empty let variable. * src/posixos.c (osync_parse_mutex): Free existing osync_tmpfile. * src/misc.c (get_tmpfd): Set umask() before invoking mkstemp(). * src/ar.c (ar_parse_name): Check invalid name (shouldn't happen). * src/function.c (define_new_function): Free previous function entry when replacing it with a new one. * src/job.c (child_execute_job): Initialize pid for safety. (construct_command_argv_internal): In oneshell mode ensure that the returned argv has the right format (0th element is a pointer to the entire buffer).
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/features/varnesting12
-rw-r--r--tests/scripts/functions/let5
-rw-r--r--tests/scripts/targets/ONESHELL2
-rw-r--r--tests/test_driver.pl2
4 files changed, 7 insertions, 14 deletions
diff --git a/tests/scripts/features/varnesting b/tests/scripts/features/varnesting
index d8f3ffbb..0fbb332d 100644
--- a/tests/scripts/features/varnesting
+++ b/tests/scripts/features/varnesting
@@ -9,8 +9,7 @@ variable2 := Hello
y = $(subst 1,2,$(x))
z = y
a := $($($(z)))
-all:
- @echo $(a)
+all: ; @echo $(a)
',
'', "Hello\n");
@@ -21,15 +20,8 @@ all:
run_make_test('
VARIABLE = $(eval VARIABLE := echo hi)$(VARIABLE)
-wololo:
- @$(VARIABLE)
+wololo: ; @$(VARIABLE)
',
'', "hi\n");
1;
-
-
-
-
-
-
diff --git a/tests/scripts/functions/let b/tests/scripts/functions/let
index f1012e56..48aec78f 100644
--- a/tests/scripts/functions/let
+++ b/tests/scripts/functions/let
@@ -39,11 +39,12 @@ all:;@echo 'a=,$a,' 'b=,$b,' 'x=,$x,' 'y=,$y,' 'z=,$z,'
# We still expand the list and body.
run_make_test('
null =
+v = $(let ,$(info blankvar),abc)
x = $(let $(null),$(info side-effect),abc)
y = $(let y,,$ydef)
-all: ; @echo $x$y',
- '', "side-effect\nabcdef\n");
+all: ; @echo $v/$x/$y',
+ '', "blankvar\nside-effect\nabc/abc/def\n");
# The example macro from the manual.
run_make_test('
diff --git a/tests/scripts/targets/ONESHELL b/tests/scripts/targets/ONESHELL
index 481de088..f9da14b3 100644
--- a/tests/scripts/targets/ONESHELL
+++ b/tests/scripts/targets/ONESHELL
@@ -10,7 +10,7 @@ if ($port_type ne 'W32') {
# Some shells (*shakes fist at Solaris*) cannot handle multiple flags in
# separate arguments.
my $t = `$sh_name -e -c true 2>/dev/null`;
- my $multi_ok = $? == 0;
+ $multi_ok = $? == 0;
}
# Simple
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 58a782f6..b64fffb6 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -197,7 +197,7 @@ sub toplevel
'TZ', 'TMPDIR', 'HOME', 'USER', 'LOGNAME', 'PATH',
'LD_LIBRARY_PATH',
# *SAN things
- 'ASAN_OPTIONS', 'UBSAN_OPTIONS',
+ 'ASAN_OPTIONS', 'UBSAN_OPTIONS', 'LSAN_OPTIONS',
# Purify things
'PURIFYOPTIONS',
# Windows-specific things