changeset 21939:eac31af360db

verify that only existing JVMCI services and options are exported in make/defs.make
author Doug Simon <doug.simon@oracle.com>
date Fri, 12 Jun 2015 13:04:35 +0200
parents 95956bc1b1a3
children 35300ccb3eb0
files make/jvmci.make mx/mx_graal_makefile.py
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/make/jvmci.make	Fri Jun 12 01:25:58 2015 +0200
+++ b/make/jvmci.make	Fri Jun 12 13:04:35 2015 +0200
@@ -86,13 +86,16 @@
     $(QUIETLY) rm -r $(TMP)
 endef
 
-# Verifies that make/defs.make contains a line for each file in a list of files.
+# Verifies that make/defs.make contains an appropriate line for each JVMCI service or option
+# and that only existing JVMCI services and options are exported.
 # Arguments:
-#  1: list of files
+#  1: list of service or option files
 #  2: prefix to apply to each file to create match pattern
 define verify_defs_make
     $(eval defs=make/defs.make)
-    $(foreach file,$(1),$(if $(shell grep '$(2)$(file)' $(defs) > /dev/null && echo found), , $(error "Pattern '$(2)$(file)' not found in $(defs)")))
+    $(eval exports=$(shell grep '$(2)' make/defs.make | sed 's:.*$(2)::g'))
+    $(foreach file,$(1),$(if $(findstring $(file),$(exports)), ,$(error "Pattern '$(2)$(file)' not found in $(defs)")))
+    $(foreach export,$(exports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(2)$(export)' should not be in $(defs)")))
 endef
 
 all: default
--- a/mx/mx_graal_makefile.py	Fri Jun 12 01:25:58 2015 +0200
+++ b/mx/mx_graal_makefile.py	Fri Jun 12 13:04:35 2015 +0200
@@ -246,13 +246,16 @@
     $(QUIETLY) rm -r $(TMP)
 endef
 
-# Verifies that make/defs.make contains a line for each file in a list of files.
+# Verifies that make/defs.make contains an appropriate line for each JVMCI service or option
+# and that only existing JVMCI services and options are exported.
 # Arguments:
-#  1: list of files
+#  1: list of service or option files
 #  2: prefix to apply to each file to create match pattern
 define verify_defs_make
     $(eval defs=make/defs.make)
-    $(foreach file,$(1),$(if $(shell grep '$(2)$(file)' $(defs) > /dev/null && echo found), , $(error "Pattern '$(2)$(file)' not found in $(defs)")))
+    $(eval exports=$(shell grep '$(2)' make/defs.make | sed 's:.*$(2)::g'))
+    $(foreach file,$(1),$(if $(findstring $(file),$(exports)), ,$(error "Pattern '$(2)$(file)' not found in $(defs)")))
+    $(foreach export,$(exports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(2)$(export)' should not be in $(defs)")))
 endef
 
 all: default