test/Makefile

Print this page
rev 7806 : 8015068: Use jtreg -exclude for handling problemList.txt exclusions
Reviewed-by: duke

@@ -54,171 +54,36 @@
 UNIQ      = uniq
 WC        = wc
 ZIP       = zip
 
 # Get OS name from uname
-UNAME_S := $(shell $(UNAME) -s)
+UNAME_O := $(shell $(UNAME) -o)
 
 # Commands to run on paths to make mixed paths for java on windows
-GETMIXEDPATH=$(ECHO)
-
-# Location of developer shared files
-SLASH_JAVA = /java
-
-# Platform specific settings
-ifeq ($(UNAME_S), SunOS)
-  OS_NAME     = solaris
-  OS_ARCH    := $(shell $(UNAME) -p)
-  OS_VERSION := $(shell $(UNAME) -r)
-endif
-ifeq ($(UNAME_S), Linux)
-  OS_NAME     = linux
-  OS_ARCH    := $(shell $(UNAME) -m)
-  # Check for unknown arch, try uname -p if uname -m says unknown
-  ifeq ($(OS_ARCH),unknown)
-    OS_ARCH    := $(shell $(UNAME) -p)
-  endif
-  OS_VERSION := $(shell $(UNAME) -r)
-endif
-ifeq ($(UNAME_S), Darwin)
-  OS_NAME     = macosx
-  OS_ARCH    := $(shell $(UNAME) -m)
-  # Check for unknown arch, try uname -p if uname -m says unknown
-  ifeq ($(OS_ARCH),unknown)
-    OS_ARCH    := $(shell $(UNAME) -p)
-  endif
-  OS_VERSION := $(shell $(UNAME) -r)
-endif
-ifeq ($(OS_NAME),)
-  OS_NAME = windows
-  # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
-  # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
-  ifeq ($(PROCESSOR_IDENTIFIER),)
-    PROC_ARCH:=$(shell $(UNAME) -m)
-  else
-    PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
-  endif
-  OS_ARCH:=$(PROC_ARCH)
-  SLASH_JAVA = J:
-  EXESUFFIX = .exe
-  # These need to be different depending on MKS or CYGWIN
-  ifeq ($(findstring cygdrive,$(shell ($(CD) C:/ && $(PWD)))), )
-    GETMIXEDPATH  = dosname -s
-    OS_VERSION   := $(shell $(UNAME) -r)
-  else
+ifeq ($(UNAME_O), Cygwin)
     GETMIXEDPATH  = cygpath -m -s
-    OS_VERSION   := $(shell $(UNAME) -s | $(CUT) -d'-' -f2)
-  endif
-endif
-
-# Only want major and minor numbers from os version
-OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)
-
-# Name to use for x86_64 arch (historically amd64, but should change someday)
-OS_ARCH_X64_NAME:=amd64
-#OS_ARCH_X64_NAME:=x64
-
-# Alternate arch names (in case this arch is known by a second name)
-#   PROBLEM_LISTS may use either name.
-OS_ARCH2-amd64:=x64
-#OS_ARCH2-x64:=amd64
-
-# Try and use the arch names consistently
-OS_ARCH:=$(patsubst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst X64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst AMD64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst amd64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst x86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst 8664,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst EM64T,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst em64t,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst Intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst INTEL64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
-OS_ARCH:=$(patsubst IA64,ia64,$(OS_ARCH))
-OS_ARCH:=$(patsubst X86,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst x86,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst i386,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst i486,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst i686,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst 386,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst 486,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst 586,i586,$(OS_ARCH))
-OS_ARCH:=$(patsubst 686,i586,$(OS_ARCH))
-
-# Default  ARCH_DATA_MODEL settings
-ARCH_DATA_MODEL-i586 = 32
-ARCH_DATA_MODEL-$(OS_ARCH_X64_NAME) = 64
-ARCH_DATA_MODEL-ia64 = 64
-ARCH_DATA_MODEL-sparc = 32
-ARCH_DATA_MODEL-sparcv9 = 64
-
-# If ARCH_DATA_MODEL is not defined, try and pick a reasonable default
-ifndef ARCH_DATA_MODEL
-  ARCH_DATA_MODEL:=$(ARCH_DATA_MODEL-$(OS_ARCH))
-endif
-ifndef ARCH_DATA_MODEL
-  ARCH_DATA_MODEL=32
-endif
-
-# Platform directory name
-PLATFORM_OS = $(OS_NAME)-$(OS_ARCH)
-
-# Check ARCH_DATA_MODEL, adjust OS_ARCH accordingly on solaris
-ARCH_DATA_MODEL_ERROR= \
-  ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(PLATFORM_OS)
-ifeq ($(ARCH_DATA_MODEL),64)
-  ifeq ($(PLATFORM_OS),solaris-i586)
-    OS_ARCH=$(OS_ARCH_X64_NAME)
-  endif
-  ifeq ($(PLATFORM_OS),solaris-sparc)
-    OS_ARCH=sparcv9
-  endif
-  ifeq ($(OS_ARCH),i586)
-    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-  endif
-  ifeq ($(OS_ARCH),sparc)
-    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-  endif
 else
-  ifeq ($(ARCH_DATA_MODEL),32)
-    ifeq ($(OS_ARCH),$(OS_ARCH_X64_NAME))
-      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-    endif
-    ifeq ($(OS_ARCH),ia64)
-      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-    endif
-    ifeq ($(OS_ARCH),sparcv9)
-      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-    endif
-  else
-    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
-  endif
-endif
-
-# Alternate OS_ARCH name (defaults to OS_ARCH)
-OS_ARCH2:=$(OS_ARCH2-$(OS_ARCH))
-ifeq ($(OS_ARCH2),)
-  OS_ARCH2:=$(OS_ARCH)
+  GETMIXEDPATH=$(ECHO)
 endif
 
 # Root of this test area (important to use full paths in some places)
 TEST_ROOT := $(shell $(PWD))
 
 # Root of all test results
 ifdef ALT_OUTPUTDIR
-  ABS_OUTPUTDIR = $(ALT_OUTPUTDIR)
+  ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR); $(PWD))
 else
-  ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(PLATFORM_OS)
+  ABS_OUTPUTDIR = $(TEST_ROOT)
 endif
+
 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
 
 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
 ifndef PRODUCT_HOME
   # Try to use j2sdk-image if it exists
-  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/j2sdk-image
+  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/j2sdk-image
   PRODUCT_HOME :=                                       \
     $(shell                                             \
       if [ -d $(ABS_JDK_IMAGE) ] ; then                 \
          $(ECHO) "$(ABS_JDK_IMAGE)";                    \
        else                                             \

@@ -238,49 +103,37 @@
 #   Should be passed into anything running the vm (java, javac, javadoc, ...).
 ifdef JPRT_PRODUCT_VM_ARGS
   JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
 endif
 
-# Check JAVA_ARGS arguments based on ARCH_DATA_MODEL etc.
-ifeq ($(OS_NAME),solaris)
-  D64_ERROR_MESSAGE=Mismatch between ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) and use of -d64 in JAVA_ARGS=$(JAVA_ARGS)
-  ifeq ($(ARCH_DATA_MODEL),32)
-    ifneq ($(findstring -d64,$(JAVA_ARGS)),)
-      x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
-    endif
-  endif
-  ifeq ($(ARCH_DATA_MODEL),64)
-    ifeq ($(findstring -d64,$(JAVA_ARGS)),)
-      x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
-    endif
-  endif
-endif
-
 # Macro to run make and set the shared library permissions
 define SharedLibraryPermissions
 $(MAKE) SHARED_LIBRARY_DIR=$1 UNIQUE_DIR=$@ shared_library_permissions
 endef
 
 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
-ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
 ifdef JPRT_ARCHIVE_BUNDLE
   ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
+else
+  ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
 endif
 
 # How to create the test bundle (pass or fail, we want to create this)
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
                    && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
                    && $(CHMOD) -R a+r . \
                    && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
-SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
+
+# important results files
+SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
 STATS_TXT_NAME = Stats.txt
-STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/$(STATS_TXT_NAME)
-RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
-PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
-FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
-EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
+STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
+RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
+PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
+FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
+EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
 
 TESTEXIT = \
   if [ ! -s $(EXITCODE) ] ; then \
     $(ECHO) "ERROR: EXITCODE file not filled in."; \
     $(ECHO) "1" > $(EXITCODE); \

@@ -314,11 +167,11 @@
       fi; \
     fi; \
     runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
-    exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
+    exclc="FIXME CODETOOLS-7900176"; \
     $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
       >> $(STATS_TXT); \
   else \
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
   fi; \

@@ -349,60 +202,45 @@
 
 # jtreg tests
 
 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
 ifndef JT_HOME
-  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
   ifdef JPRT_JTREG_HOME
     JT_HOME = $(JPRT_JTREG_HOME)
+  else
+    # maybe it's on the path?
+    JT_HOME = $(shell which jtreg 2> /dev/null | grep -v '^no jtreg in')
   endif
 endif
 
-# Expect JPRT to set TESTDIRS to the jtreg test dirs
-ifndef TESTDIRS
-  TESTDIRS = demo
-endif
-
-# Some tests annoy me and fail frequently
-PROBLEM_LIST=ProblemList.txt
-PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
-EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
+# Problematic tests to be excluded
+PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
 
 # Create exclude list for this platform and arch
 ifdef NO_EXCLUDES
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
-        @$(ECHO) "NOTHING_EXCLUDED" > $@
+  JTREG_EXCLUSIONS =
 else
-$(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
-        @$(RM) $@ $@.temp1 $@.temp2
-        @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)'  ) ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH2)'     ) ;\
-          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all'             ) ;\
-          ($(ECHO) "#") ;\
-        ) | $(SED) -e 's@^[\ ]*@@' \
-          | $(EGREP) -v '^#' > $@.temp1
-        @for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \
-          ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
-        done
-        @$(ECHO) "# at least one line" >> $@.temp2
-        @( $(EGREP) -v '^#' $@.temp2 ; true ) > $@
-        @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
+  JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
 endif
 
 # Select list of directories that exist
 define TestDirs
 $(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
 endef
-# Running batches of tests with or without agentvm
-define RunBatch
-$(ECHO) "Running tests: $?"
+# convert list of directories to dos paths
+define MixedDirs
+$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
+endef
+# Running a batch of tests
+define RunTests
+$(ECHO) "Running tests: $@"
 $(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" UNIQUE_DIR=$@ jtreg_tests
 endef
+# Running a batch of tests (ensuring that there are tests to run)
+define RunBatch
+$(if $?,$(call RunTests))
+endef
 define SummaryInfo
 $(ECHO) "########################################################"
 $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
 $(ECHO) "########################################################"
 endef

@@ -439,18 +277,25 @@
 
 # All beans tests
 jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
         @$(SummaryInfo)
 
+JDK_ALL_TARGETS += jdk_lang
+JDK_DEFAULT_TARGETS += jdk_lang
+jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc sun/reflect vm)
+        $(call RunBatch)
+
 JDK_ALL_TARGETS += jdk_io
 JDK_DEFAULT_TARGETS += jdk_io
 jdk_io: $(call TestDirs, java/io)
         $(call RunBatch)
 
-JDK_ALL_TARGETS += jdk_lang
-JDK_DEFAULT_TARGETS += jdk_lang
-jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc sun/reflect vm)
+JDK_ALL_TARGETS += jdk_jdi
+jdk_jdi: $(call TestDirs, com/sun/jdi)
+        $(call RunBatch)
+
+jdk_jfr: $(call TestDirs, com/oracle/jfr)
         $(call RunBatch)
 
 JDK_ALL_TARGETS += jdk_jmx
 jdk_jmx: $(call TestDirs, javax/management com/sun/jmx)
         $(call RunBatch)

@@ -494,17 +339,17 @@
 
 jdk_nio: $(call TestDirs, java/nio sun/nio com/oracle/nio)
         $(call SharedLibraryPermissions,java/nio/channels)
         $(call RunBatch)
 
-jdk_sctp: $(call TestDirs, com/sun/nio/sctp)
-        $(call RunBatch)
-
 JDK_ALL_TARGETS += jdk_rmi
 jdk_rmi: $(call TestDirs, java/rmi sun/rmi javax/rmi/ssl)
         $(call RunBatch)
 
+jdk_sctp: $(call TestDirs, com/sun/nio/sctp)
+        $(call RunBatch)
+
 JDK_ALL_TARGETS += jdk_security1
 JDK_DEFAULT_TARGETS += jdk_security1
 jdk_security1: $(call TestDirs, java/security)
         $(call RunBatch)
 

@@ -535,27 +380,15 @@
 JDK_ALL_TARGETS += jdk_text
 JDK_DEFAULT_TARGETS += jdk_text
 jdk_text: $(call TestDirs, java/text sun/text)
         $(call RunBatch)
 
-JDK_ALL_TARGETS += jdk_jdi
-jdk_jdi: $(call TestDirs, com/sun/jdi)
-        $(call RunBatch)
-
 JDK_ALL_TARGETS += jdk_tools
 jdk_tools: $(call TestDirs, com/sun/tools sun/jvmstat sun/tools tools)
         $(call SharedLibraryPermissions,tools/launcher)
         $(call RunBatch)
 
-ifdef OPENJDK
-jdk_jfr:
-else
-JDK_ALL_TARGETS += jdk_jfr
-jdk_jfr: $(call TestDirs, com/oracle/jfr)
-        $(call RunBatch)
-endif
-
 JDK_ALL_TARGETS += jdk_util
 JDK_DEFAULT_TARGETS += jdk_util
 jdk_util: $(call TestDirs, java/util sun/util)
         $(call RunBatch)
 

@@ -622,26 +455,24 @@
 
 # Make sure jtreg exists
 $(JTREG): $(JT_HOME)
 
 # Run jtreg
-jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST)
-        @$(EXPAND) $(EXCLUDELIST) \
-            | $(CUT) -d' ' -f1 \
-            | $(SED) -e 's@^@Excluding: @'
+jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
         (                                                                    \
           ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
             export JT_HOME;                                                  \
             $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
               $(JTREG_BASIC_OPTIONS)                                         \
-              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
-              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
+              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
+              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
               -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
-              -exclude:$(shell $(GETMIXEDPATH) "$(EXCLUDELIST)")             \
+              $(JTREG_EXCLUSIONS)                                            \
               $(JTREG_TEST_OPTIONS)                                          \
               $(TESTDIRS)                                                    \
-          ) ; $(BUNDLE_UP_AND_EXIT)                                          \
+          ) ;                                                                \
+          $(BUNDLE_UP_AND_EXIT)                                              \
         ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
 
 # Rule that may change execute permissions on shared library files.
 #  Files in repositories should never have execute permissions, but there
 #  are some tests that have pre-built shared libraries, and these windows