From 561eafd6d077d0406d9df585c20ea46f500073f0 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 Oct 2026 13:04:17 -0700 Subject: [PATCH 1/2] Define DAIKONDIR with ":=" in test Makefiles With "?=", DAIKONDIR is recursively expanded, so MAKEFILE_LIST is read when DAIKONDIR is used rather than where it is defined. After a later include, DAIKONDIR can be computed relative to the wrong file. Also fix the depth in tests/daikon-tests/Makefile, where ".." yielded the tests/ directory rather than the Daikon clone. --- tests/daikon-tests/Makefile | 4 +++- tests/diff-tests/Makefile.common | 4 +++- tests/dyncomp-tests/Makefile.common | 4 +++- tests/kvasir-tests/Makefile.common | 4 +++- tests/merge-invariants-tests/drawlet/Makefile | 4 +++- tests/parser-tests/Makefile | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/daikon-tests/Makefile b/tests/daikon-tests/Makefile index 3342685d68..aa5b656531 100644 --- a/tests/daikon-tests/Makefile +++ b/tests/daikon-tests/Makefile @@ -2,7 +2,9 @@ # Read Makefile in parent directory to see what this all means # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword ${MAKEFILE_LIST}))..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../..) +endif SCRIPTS=${DAIKONDIR}/scripts # Help system diff --git a/tests/diff-tests/Makefile.common b/tests/diff-tests/Makefile.common index 7a22461dfd..c0edcaf4ab 100644 --- a/tests/diff-tests/Makefile.common +++ b/tests/diff-tests/Makefile.common @@ -6,7 +6,9 @@ # of Diff. # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +endif DAIKON_CLASSPATH := ${DAIKONDIR}/java:${DAIKONDIR}/java/lib/*:${DAIKONDIR}/daikon.jar diff --git a/tests/dyncomp-tests/Makefile.common b/tests/dyncomp-tests/Makefile.common index 173bce853b..261b7946d0 100644 --- a/tests/dyncomp-tests/Makefile.common +++ b/tests/dyncomp-tests/Makefile.common @@ -3,7 +3,9 @@ # Forked from $DAIKONDIR/tests/kvasir-tests/Makefile.common # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +endif ifeq ($(shell uname -m),x86_64) VALGRIND_ARCH := amd64 diff --git a/tests/kvasir-tests/Makefile.common b/tests/kvasir-tests/Makefile.common index c1fc9bd33b..aeab77975a 100644 --- a/tests/kvasir-tests/Makefile.common +++ b/tests/kvasir-tests/Makefile.common @@ -1,7 +1,9 @@ # This is a -*- makefile -*-, Emacs # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) +endif DAIKON_JAR := ${DAIKONDIR}/daikon.jar # Fails when running "clean". # $(if $(wildcard ${DAIKON_JAR}),,$(error daikon.jar not found at ${DAIKON_JAR})) diff --git a/tests/merge-invariants-tests/drawlet/Makefile b/tests/merge-invariants-tests/drawlet/Makefile index da2a137a0f..332447d42a 100644 --- a/tests/merge-invariants-tests/drawlet/Makefile +++ b/tests/merge-invariants-tests/drawlet/Makefile @@ -9,7 +9,9 @@ # files are in drawlet_src.zip in this directory # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) +endif DAIKON_ARGS = '--ppt-omit-pattern=^org\.' --no_text_output --no_show_progress --config_option daikon.Debug.show_stack_trace=true DAIKON = ${DAIKONDIR}/java/daikon/Daikon.class diff --git a/tests/parser-tests/Makefile b/tests/parser-tests/Makefile index 6a1755c3ea..4adb545dde 100644 --- a/tests/parser-tests/Makefile +++ b/tests/parser-tests/Makefile @@ -1,5 +1,7 @@ # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR ?= $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../..) +ifeq ($(origin DAIKONDIR), undefined) + DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../..) +endif DAIKON_CLASSPATH := ${DAIKONDIR}/java:${DAIKONDIR}/java/lib/*:${DAIKONDIR}/daikon.jar From 748ae5549f52a3816bc2c570c4d2f79fe5461073 Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Sat, 10 Oct 2026 13:35:25 -0700 Subject: [PATCH 2/2] Capture the Makefile directory with ":=" and set DAIKONDIR with "?=" Also remove the unused LDAIKONDIR from the rijndael test, and let the environment override DAIKONDIR in chicory-tests/option-tests. --- tests/Makefile.common | 10 ++++------ tests/chicory-tests/option-tests/Makefile | 5 ++++- tests/daikon-tests/Makefile | 7 ++++--- tests/daikon-tests/purity/Makefile | 7 ++++--- tests/diff-tests/Makefile.common | 7 ++++--- tests/dyncomp-tests/Makefile.common | 7 ++++--- tests/kvasir-tests/Makefile.common | 7 ++++--- tests/kvasir-tests/rijndael/Makefile | 1 - tests/merge-invariants-tests/drawlet/Makefile | 7 ++++--- tests/parser-tests/Makefile | 7 ++++--- 10 files changed, 36 insertions(+), 29 deletions(-) diff --git a/tests/Makefile.common b/tests/Makefile.common index 38dde8e8cb..af4a817ee9 100644 --- a/tests/Makefile.common +++ b/tests/Makefile.common @@ -134,12 +134,10 @@ endif # DAIKONDIR is the clone of the 'daikon' project. -# Would like to use simple '?=' but this is recursively expanded while ':=' is simply expanded. -# The include of Makefile.user (if it exists) will change the value of MAKEFILE_LIST and thus -# '?=' will not evaluate as we desire. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))..) -endif +# TESTS_COMMON_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +TESTS_COMMON_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${TESTS_COMMON_DIR}..) # COMMON_HERE is where the Makefile.common is located. COMMON_HERE?=${DAIKONDIR}/tests diff --git a/tests/chicory-tests/option-tests/Makefile b/tests/chicory-tests/option-tests/Makefile index bc4efef8c1..84af9b7ec9 100644 --- a/tests/chicory-tests/option-tests/Makefile +++ b/tests/chicory-tests/option-tests/Makefile @@ -3,7 +3,10 @@ # # DAIKONDIR is the clone of the 'daikon' project. -DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) +# OPTION_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +OPTION_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${OPTION_TESTS_DIR}../../..) # StackAr sources are used for option testing SRC_DIR = ${DAIKONDIR}/tests/sources diff --git a/tests/daikon-tests/Makefile b/tests/daikon-tests/Makefile index aa5b656531..09bafb92e9 100644 --- a/tests/daikon-tests/Makefile +++ b/tests/daikon-tests/Makefile @@ -2,9 +2,10 @@ # Read Makefile in parent directory to see what this all means # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../..) -endif +# DAIKON_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +DAIKON_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${DAIKON_TESTS_DIR}../..) SCRIPTS=${DAIKONDIR}/scripts # Help system diff --git a/tests/daikon-tests/purity/Makefile b/tests/daikon-tests/purity/Makefile index 263f76739f..e41dc7dc05 100644 --- a/tests/daikon-tests/purity/Makefile +++ b/tests/daikon-tests/purity/Makefile @@ -3,9 +3,10 @@ # Read Makefile.common for what all of this means # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) -endif +# PURITY_TEST_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +PURITY_TEST_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${PURITY_TEST_DIR}../../..) MAIN_CLASS:=misc.PurityTester diff --git a/tests/diff-tests/Makefile.common b/tests/diff-tests/Makefile.common index c0edcaf4ab..d3adfa3387 100644 --- a/tests/diff-tests/Makefile.common +++ b/tests/diff-tests/Makefile.common @@ -6,9 +6,10 @@ # of Diff. # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) -endif +# DIFF_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +DIFF_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${DIFF_TESTS_DIR}../..) DAIKON_CLASSPATH := ${DAIKONDIR}/java:${DAIKONDIR}/java/lib/*:${DAIKONDIR}/daikon.jar diff --git a/tests/dyncomp-tests/Makefile.common b/tests/dyncomp-tests/Makefile.common index 261b7946d0..4fe5cb4a49 100644 --- a/tests/dyncomp-tests/Makefile.common +++ b/tests/dyncomp-tests/Makefile.common @@ -3,9 +3,10 @@ # Forked from $DAIKONDIR/tests/kvasir-tests/Makefile.common # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) -endif +# DYNCOMP_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +DYNCOMP_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${DYNCOMP_TESTS_DIR}../..) ifeq ($(shell uname -m),x86_64) VALGRIND_ARCH := amd64 diff --git a/tests/kvasir-tests/Makefile.common b/tests/kvasir-tests/Makefile.common index aeab77975a..61fb759a2f 100644 --- a/tests/kvasir-tests/Makefile.common +++ b/tests/kvasir-tests/Makefile.common @@ -1,9 +1,10 @@ # This is a -*- makefile -*-, Emacs # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))../..) -endif +# KVASIR_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +KVASIR_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${KVASIR_TESTS_DIR}../..) DAIKON_JAR := ${DAIKONDIR}/daikon.jar # Fails when running "clean". # $(if $(wildcard ${DAIKON_JAR}),,$(error daikon.jar not found at ${DAIKON_JAR})) diff --git a/tests/kvasir-tests/rijndael/Makefile b/tests/kvasir-tests/rijndael/Makefile index ff91649ad2..cb8b6106b6 100644 --- a/tests/kvasir-tests/rijndael/Makefile +++ b/tests/kvasir-tests/rijndael/Makefile @@ -15,7 +15,6 @@ else JAVA19_OR_NEWER := 0 endif -LDAIKONDIR ?= $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) OS_ID := $(shell sed -n -e 's/^NAME="\(.*\)"/\1/p' /etc/os-release | cut -d " " -f1) OS_REL := $(shell sed -n -e 's/^VERSION_ID="(.*)"/\1/' /etc/os-release) ifeq (${OS_ID},Ubuntu) diff --git a/tests/merge-invariants-tests/drawlet/Makefile b/tests/merge-invariants-tests/drawlet/Makefile index 332447d42a..e17ef2518c 100644 --- a/tests/merge-invariants-tests/drawlet/Makefile +++ b/tests/merge-invariants-tests/drawlet/Makefile @@ -9,9 +9,10 @@ # files are in drawlet_src.zip in this directory # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../../..) -endif +# DRAWLET_TEST_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +DRAWLET_TEST_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${DRAWLET_TEST_DIR}../../..) DAIKON_ARGS = '--ppt-omit-pattern=^org\.' --no_text_output --no_show_progress --config_option daikon.Debug.show_stack_trace=true DAIKON = ${DAIKONDIR}/java/daikon/Daikon.class diff --git a/tests/parser-tests/Makefile b/tests/parser-tests/Makefile index 4adb545dde..9b01ef29e8 100644 --- a/tests/parser-tests/Makefile +++ b/tests/parser-tests/Makefile @@ -1,7 +1,8 @@ # DAIKONDIR is the clone of the 'daikon' project. -ifeq ($(origin DAIKONDIR), undefined) - DAIKONDIR := $(realpath $(dir $(lastword ${MAKEFILE_LIST}))../..) -endif +# PARSER_TESTS_DIR is simply expanded (":=") so that it is not affected by later +# includes, which change MAKEFILE_LIST. +PARSER_TESTS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +DAIKONDIR ?= $(realpath ${PARSER_TESTS_DIR}../..) DAIKON_CLASSPATH := ${DAIKONDIR}/java:${DAIKONDIR}/java/lib/*:${DAIKONDIR}/daikon.jar