1 #
   2 # Makefile to run jtreg and other tests
   3 #
   4 
   5 # Product builds and langtools builds
   6 #
   7 # A full product build (or "control" build) creates a complete JDK image.
   8 # To test a product build, set TESTJAVA to the path for the image.
   9 #
  10 # A langtools build just builds the langtools components of a JDK.
  11 # To test a langtools build, set TESTJAVA to the path for a recent JDK
  12 # build, and set TESTBOOTCLASSPATH to the compiled langtools classes --
  13 # for example build/classes or dist/lib/classes.jar.
  14 
  15 # JPRT
  16 # JPRT may invoke this Makefile directly, as part of a langtools build,
  17 # or indirectly, via FOREST/test/Makefile, as part of a control build.
  18 
  19 
  20 # Utilities used
  21 AWK       = awk
  22 CAT       = cat
  23 CD        = cd
  24 CHMOD     = chmod
  25 CP        = cp
  26 CUT       = cut
  27 DIRNAME   = dirname
  28 ECHO      = echo
  29 EGREP     = egrep
  30 EXPAND    = expand
  31 FIND      = find
  32 MKDIR     = mkdir
  33 PWD       = pwd
  34 SED       = sed
  35 SORT      = sort
  36 TEE       = tee
  37 UNAME     = uname
  38 UNIQ      = uniq
  39 WC        = wc
  40 ZIP       = zip
  41 
  42 # Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
  43 UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
  44 
  45 # Commands to run on paths to make mixed paths for java on windows
  46 ifeq ($(UNAME_S), CYGWIN)
  47   # Location of developer shared files
  48   SLASH_JAVA = J:
  49   GETMIXEDPATH = cygpath -m
  50 else
  51   # Location of developer shared files
  52   SLASH_JAVA = /java
  53 
  54   GETMIXEDPATH=$(ECHO)
  55 endif
  56 
  57 # Get OS/ARCH specifics
  58 OSNAME = $(shell uname -s)
  59 ifeq ($(OSNAME), SunOS)
  60   SLASH_JAVA = /java
  61   PLATFORM = solaris
  62   ARCH = $(shell uname -p)
  63   ifeq ($(ARCH), i386)
  64     ARCH=i586
  65   endif
  66 endif
  67 ifeq ($(OSNAME), Linux)
  68   SLASH_JAVA = /java
  69   PLATFORM = linux
  70   ARCH = $(shell uname -m)
  71   ifeq ($(ARCH), i386)
  72     ARCH=i586
  73   endif
  74 endif
  75 ifeq ($(OSNAME), Darwin)
  76   PLATFORM = bsd
  77   ARCH = $(shell uname -m)
  78   ifeq ($(ARCH), i386)
  79     ARCH=i586
  80   endif
  81 endif
  82 ifeq ($(OSNAME), Windows_NT)
  83   # MKS
  84   PLATFORM=windows
  85 endif
  86 ifeq ($(PLATFORM),)
  87   PLATFORM = windows
  88   CYGPATH = | cygpath -m -s -f -
  89 endif
  90 
  91 ifeq ($(PLATFORM), windows)
  92   SLASH_JAVA = J:
  93   ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
  94     ARCH=ia64
  95   else
  96     ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
  97       ARCH=x64
  98     else
  99       ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
 100         ARCH=x64
 101       else
 102         ARCH=i586
 103       endif
 104     endif
 105   endif
 106   EXE_SUFFIX=.exe
 107 endif
 108 
 109 # Root of this test area (important to use full paths in some places)
 110 TEST_ROOT := $(shell pwd $(CYGPATH) )
 111 
 112 # Default bundle of all test results (passed or not) (JPRT only)
 113 ifdef JPRT_JOB_ID
 114   JPRT_CLEAN = clean
 115   JPRT_ARCHIVE_BUNDLE = $(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
 116 endif
 117 
 118 ifeq ($(PLATFORM), windows)
 119   SLASH_JAVA = J:
 120 else
 121   SLASH_JAVA = /java
 122 endif
 123 
 124 # Default JTREG to run
 125 ifdef JPRT_JTREG_HOME
 126   JTREG_HOME = $(JPRT_JTREG_HOME)
 127 else
 128   JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
 129 endif
 130 JTREG = $(JTREG_HOME)/bin/jtreg
 131 JTDIFF = $(JTREG_HOME)/bin/jtdiff
 132 
 133 # Default JCK to run
 134 ifdef JPRT_JCK_HOME
 135   JCK_HOME = $(JPRT_JCK_HOME)
 136 else
 137   JCK_HOME = $(SLASH_JAVA)/re/jck/8/promoted/latest/binaries
 138 endif
 139 
 140 # Default JDK for JTREG and JCK
 141 #
 142 # JT_JAVA is the version of java used to run jtreg/JCK. Since it is now
 143 # standard to execute tests in sameVM mode, it should normally be set the
 144 # same as TESTJAVA (although not necessarily so.)
 145 #
 146 ifdef JPRT_JAVA_HOME
 147   JT_JAVA = $(JPRT_JAVA_HOME)
 148 else
 149   JT_JAVA = $(SLASH_JAVA)/re/jdk/1.7.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 150 endif
 151 
 152 # Default JDK to test
 153 ifdef JPRT_IMPORT_PRODUCT_HOME
 154   TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
 155 else
 156   TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
 157 endif
 158 
 159 # PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from
 160 # make/Makefile
 161 # For langtools, this is a directory containing build and dist
 162 # For a control build, this is build/$(PRODUCT)-$(ARCH)/XYZ-image
 163 #       (i.e, j2sdk-image or jdk-module-image)
 164 ifdef PRODUCT_HOME
 165   ifeq ($(shell [ -r $(PRODUCT_HOME)/dist/lib/classes.jar ]; echo $$?),0)
 166     TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
 167   endif
 168   ifeq ($(shell [ -r $(PRODUCT_HOME)/bin/javac$(EXE_SUFFIX) ]; echo $$?),0)
 169     TESTJAVA = $(PRODUCT_HOME)
 170   endif
 171 endif
 172 
 173 ifdef TESTBOOTCLASSPATH
 174   JTREG_OPTIONS += -Xbootclasspath/p:$(TESTBOOTCLASSPATH)
 175 ### In the following, -refvmoptions is an undocumented option
 176 ### The following does not work JCK 7 b30 2/6/2010. Awaiting b31.
 177   JCK_OPTIONS += \
 178         -vmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
 179         -refvmoptions:-Xbootclasspath/p:$(TESTBOOTCLASSPATH)
 180 endif
 181 
 182 # Concurrency is the number of tests that can execute at once.
 183 # On an otherwise empty machine, suggest setting to (#cpus + 2)
 184 # If unset, the default is (#cpus)
 185 ### RFE: determine and use #cpus
 186 ifdef CONCURRENCY
 187   JTREG_OPTIONS += -agentvm -concurrency:$(CONCURRENCY)
 188 else
 189   JTREG_OPTIONS += -samevm
 190 endif
 191 
 192 ifdef JCK_CONCURRENCY
 193   JCK_OPTIONS += -concurrency:$(JCK_CONCURRENCY)
 194 endif
 195 
 196 # JCK is executed using "Multi-JVM Group Mode", which is a hybrid
 197 # of otherVM and sameVM modes. New JVMs are created and reused for
 198 # a number of tests, then eventually discarded and a new one started.
 199 # This amortizes the JVM startup time.  The "group size" defines
 200 # how many tests are run in a JVM before it is replaced.
 201 # If unset, the default is 100.
 202 JCK_GROUP_SIZE = 1000
 203 ifdef JCK_GROUP_SIZE
 204   JCK_COMPILER_OPTIONS += \
 205     -jtoptions:-Ejck.env.compiler.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE) \
 206     -jtoptions:-Ejck.env.compiler.compRefExecute.groupMode.groupSize=$(JCK_GROUP_SIZE)
 207 ### The following is not supported. Awaiting RFE 6924287
 208 ### 6924287: Jck4Jdk: Allow to configure test group size for group mode via simple command line option
 209 ###  JCK_RUNTIME_OPTIONS += \
 210 ###    -jtoptions:-Ejck.env.runtime.testCompile.groupMode.groupSize=$(JCK_GROUP_SIZE)
 211 endif
 212 
 213 # Timeouts -- by default, increase test timeouts when running on JPRT
 214 ifdef JPRT_JOB_ID
 215   ifndef JTREG_TIMEOUT_FACTOR
 216     JTREG_TIMEOUT_FACTOR = 3
 217   endif
 218 endif
 219 ifdef JTREG_TIMEOUT_FACTOR
 220   JTREG_OPTIONS += -timeoutFactor:$(JTREG_TIMEOUT_FACTOR)
 221 endif
 222 
 223 # Default verbosity setting for jtreg
 224 JTREG_VERBOSE = fail,error,summary
 225 
 226 # Default verbosity setting for jck
 227 JCK_VERBOSE = non-pass
 228 
 229 # Assertions: some tests show failures when assertions are enabled.
 230 # Since javac is typically loaded via the bootclassloader (either via TESTJAVA
 231 # or TESTBOOTCLASSPATH), you may need -esa to enable assertions in javac.
 232 JTREG_OPTIONS += $(ASSERTION_OPTIONS)
 233 JCK_OPTIONS += $(ASSERTION_OPTIONS:%=-vmoptions:%)
 234 
 235 # Include shared options
 236 JCK_COMPILER_OPTIONS += $(JCK_OPTIONS)
 237 JCK_RUNTIME_OPTIONS += $(JCK_OPTIONS)
 238 
 239 # Exit codes:
 240 # jtreg, jck:   0: OK, 1: tests failed, 2: tests error; 3+: SERIOUS
 241 FATAL_JTREG_EXIT = 3
 242 FATAL_JCK_EXIT = 3
 243 # jtdiff: 0: OK, 1: differences found; 2+: SERIOUS
 244 FATAL_JTDIFF_EXIT = 2
 245 #
 246 # Exit -- used for final "normal" exit from "make". Redefine to "true" to avoid
 247 # having make exit with non-zero return code.
 248 EXIT = exit
 249 # Function to exit shell if exit code of preceding command is greater than or equal
 250 # to a given level. Redefine function or preceding FATAL_*_EXIT codes as needed.
 251 EXIT_IF_FATAL = status=$$?; if [ $$status -ge $(1) ]; then exit $$status ; fi
 252 
 253 # The test directories to run
 254 DEFAULT_TESTDIRS = .
 255 TESTDIRS = $(DEFAULT_TESTDIRS)
 256 
 257 # Root of all test results
 258 TEST_OUTPUT_DIR = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)/test/langtools
 259 ifdef ALT_OUTPUTDIR
 260   ABS_OUTPUTDIR := $(shell cd $(ALT_OUTPUTDIR) && pwd $(CYGPATH))
 261 else
 262   ABS_OUTPUTDIR := $(shell mkdir -p $(TEST_OUTPUT_DIR); cd $(TEST_OUTPUT_DIR) && pwd $(CYGPATH))
 263 endif
 264 ABS_TEST_OUTPUT_DIR := $(ABS_OUTPUTDIR)/testoutput/$(UNIQUE_DIR)
 265 # Subdirectories for different test runs
 266 JTREG_OUTPUT_DIR = $(ABS_OUTPUTDIR)/jtreg
 267 JCK_COMPILER_OUTPUT_DIR = $(ABS_OUTPUTDIR)/jck-compiler
 268 JCK_RUNTIME_OUTPUT_DIR = $(ABS_OUTPUTDIR)/jck-runtime-Xcompile
 269 
 270 # Default make rule -- warning, may take a while
 271 all: $(JPRT_CLEAN) jtreg-tests jck-compiler-tests jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) all-summary
 272         @echo "Testing completed successfully"
 273 
 274 jtreg apt javac javadoc javah javap jdeps: $(JPRT_CLEAN) jtreg-tests $(JPRT_ARCHIVE_BUNDLE) jtreg-summary
 275         @echo "Testing completed successfully"
 276 
 277 jck-compiler: $(JPRT_CLEAN) jck-compiler-tests $(JPRT_ARCHIVE_BUNDLE) jck-compiler-summary
 278         @echo "Testing completed successfully"
 279 
 280 jck-runtime: $(JPRT_CLEAN) jck-runtime-tests $(JPRT_ARCHIVE_BUNDLE) jck-runtime-summary
 281         @echo "Testing completed successfully"
 282 
 283 tier1: jtreg-tests-tier1
 284 
 285 # for use with JPRT -testrule
 286 all:            JTREG_TESTDIRS = .
 287 jtreg:          JTREG_TESTDIRS = .
 288 apt:            JTREG_TESTDIRS = tools/apt
 289 javac:          JTREG_TESTDIRS = tools/javac
 290 javadoc:        JTREG_TESTDIRS = tools/javadoc com/sun/javadoc
 291 javah:          JTREG_TESTDIRS = tools/javah
 292 javap:          JTREG_TESTDIRS = tools/javap
 293 jdeps:          JTREG_TESTDIRS = tools/jdeps
 294 
 295 # Run jtreg tests
 296 #
 297 # JTREG_HOME
 298 #       Installed location of jtreg
 299 # JT_JAVA
 300 #       Version of java used to run jtreg.  Should normally be the same as TESTJAVA
 301 # TESTJAVA
 302 #       Version of java to be tested.
 303 # JTREG_VERBOSE
 304 # Verbosity setting for jtreg
 305 # JTREG_OPTIONS
 306 #       Additional options for jtreg
 307 # JTREG_TESTDIRS
 308 #       Directories of tests to be run
 309 # JTREG_OUTPUT_DIR
 310 #       Where to write the results
 311 # JTREG_REFERENCE
 312 #       (Optional) reference results (e.g. work, report or summary.txt)
 313 #
 314 jtreg_tests: jtreg-tests
 315 jtreg-tests: check-jtreg FRC
 316         @rm -f -r $(JTREG_OUTPUT_DIR)/JTwork $(JTREG_OUTPUT_DIR)/JTreport \
 317             $(JTREG_OUTPUT_DIR)/diff.html $(JTREG_OUTPUT_DIR)/status.txt
 318         @mkdir -p $(JTREG_OUTPUT_DIR)
 319         JT_JAVA=$(JT_JAVA) $(JTREG) \
 320           -J-Xmx512m \
 321           -vmoption:-Xmx768m \
 322           -a -ignore:quiet $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) \
 323           -r:$(JTREG_OUTPUT_DIR)/JTreport \
 324           -w:$(JTREG_OUTPUT_DIR)/JTwork \
 325           -jdk:$(TESTJAVA) \
 326           $(JAVA_ARGS:%=-vmoption:%) \
 327           $(JTREG_OPTIONS) \
 328           $(JTREG_TESTDIRS) \
 329         || ( $(call EXIT_IF_FATAL,$(FATAL_JTREG_EXIT)) ; \
 330             echo $$status > $(JTREG_OUTPUT_DIR)/status.txt \
 331         )
 332 ifdef JTREG_REFERENCE
 333         JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JTREG_OUTPUT_DIR)/diff.html \
 334             $(JTREG_REFERENCE) $(JTREG_OUTPUT_DIR)/JTreport \
 335         || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
 336 endif
 337 
 338 jtreg-summary: FRC
 339         if [ -r $(JTREG_OUTPUT_DIR)/status.txt ]; then \
 340             echo ; echo "Summary of jtreg test failures" ; \
 341             cat $(JTREG_OUTPUT_DIR)/JTreport/text/summary.txt | \
 342                 grep -v 'Not run' | grep -v 'Passed' ; \
 343             echo ; \
 344             $(EXIT) `cat $(JTREG_OUTPUT_DIR)/status.txt` ; \
 345         fi
 346 
 347 # Check to make sure these directories exist
 348 check-jtreg: $(PRODUCT_HOME) $(JTREG)
 349 
 350 # Run JCK-compiler tests
 351 #
 352 # JCK_HOME
 353 #       Installed location of JCK: should include JCK-compiler, and JCK-extras
 354 #       Default is JCK 8.
 355 # JT_JAVA
 356 #       Version of java used to run JCK.  Should normally be the same as TESTJAVA
 357 #       Default is JDK 7
 358 # TESTJAVA
 359 #       Version of java to be tested.
 360 # JCK_VERBOSE
 361 #       Verbosity setting for jtjck
 362 # JCK_COMPILER_OPTIONS
 363 #       Additional options for JCK-compiler
 364 # JCK_COMPILER_TESTDIRS
 365 #       Directories of tests to be run
 366 # JCK_COMPILER_OUTPUT_DIR
 367 #       Where to write the results
 368 # JCK_COMPILER_REFERENCE
 369 #       (Optional) reference results (e.g. work, report or summary.txt)
 370 #
 371 jck-compiler-tests: check-jck FRC
 372         @rm -f -r $(JCK_COMPILER_OUTPUT_DIR)/work $(JCK_COMPILER_OUTPUT_DIR)/report \
 373             $(JCK_COMPILER_OUTPUT_DIR)/diff.html $(JCK_COMPILER_OUTPUT_DIR)/status.txt
 374         @mkdir -p $(JCK_COMPILER_OUTPUT_DIR)
 375         $(JT_JAVA)/bin/java -Xmx512m \
 376             -jar $(JCK_HOME)/JCK-compiler-8/lib/jtjck.jar \
 377             $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
 378             -r:$(JCK_COMPILER_OUTPUT_DIR)/report \
 379             -w:$(JCK_COMPILER_OUTPUT_DIR)/work \
 380             -jdk:$(TESTJAVA) \
 381             $(JCK_COMPILER_OPTIONS) \
 382             $(JCK_COMPILER_TESTDIRS) \
 383         || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
 384             echo $$status > $(JCK_COMPILER_OUTPUT_DIR)/status.txt \
 385         )
 386 ifdef JCK_COMPILER_REFERENCE
 387         JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_COMPILER_OUTPUT_DIR)/diff.html \
 388             $(JCK_COMPILER_REFERENCE) $(JCK_COMPILER_OUTPUT_DIR)/report \
 389         || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
 390 endif
 391 
 392 jck-compiler-summary: FRC
 393         if [ -r $(JCK_COMPILER_OUTPUT_DIR)/status.txt ]; then \
 394             echo ; echo "Summary of JCK-compiler test failures" ; \
 395             cat $(JCK_COMPILER_OUTPUT_DIR)/report/text/summary.txt | \
 396                 grep -v 'Not run' | grep -v 'Passed' ; \
 397             echo ; \
 398             $(EXIT) `cat $(JCK_COMPILER_OUTPUT_DIR)/status.txt` ; \
 399         fi
 400 
 401 # Run JCK-runtime tests in -Xcompile mode
 402 # This is a special mode to test javac by compiling the tests in the JCK-runtime test suite
 403 # Normal JCK-runtime invocation belongs in the jdk/ repository.
 404 #
 405 # JCK_HOME
 406 #       Installed location of JCK: should include JCK-compiler, JCK-runtime and JCK-extras
 407 # JT_JAVA
 408 #       Version of java used to run JCK.  Should normally be the same as TESTJAVA
 409 # TESTJAVA
 410 #       Version of java to be tested.
 411 # JCK_VERBOSE
 412 #       Verbosity setting for jtjck
 413 # JCK_RUNTIME_OPTIONS
 414 #       Additional options for JCK-runtime
 415 # JCK_RUNTIME_TESTDIRS
 416 #       Directories of tests to be run
 417 # JCK_RUNTIME_OUTPUT_DIR
 418 #       Where to write the results
 419 # JCK_RUNTIME_REFERENCE
 420 #       (Optional) reference results (e.g. work, report or summary.txt)
 421 #
 422 jck-runtime-tests: check-jck FRC
 423         @rm -f -r $(JCK_RUNTIME_OUTPUT_DIR)/work $(JCK_RUNTIME_OUTPUT_DIR)/report \
 424             $(JCK_RUNTIME_OUTPUT_DIR)/diff.html $(JCK_RUNTIME_OUTPUT_DIR)/status.txt
 425         @mkdir -p $(JCK_RUNTIME_OUTPUT_DIR)
 426         $(JT_JAVA)/bin/java -Xmx512m \
 427             -jar $(JCK_HOME)/JCK-runtime-8/lib/jtjck.jar \
 428             $(if $(JCK_VERBOSE),-v:$(JCK_VERBOSE)) \
 429             -r:$(JCK_RUNTIME_OUTPUT_DIR)/report \
 430             -w:$(JCK_RUNTIME_OUTPUT_DIR)/work \
 431             -jdk:$(TESTJAVA) \
 432             -Xcompile \
 433             $(JCK_RUNTIME_OPTIONS) \
 434             $(JCK_RUNTIME_TESTDIRS) \
 435         || ( $(call EXIT_IF_FATAL,$(FATAL_JCK_EXIT)) ; \
 436             echo $$status > $(JCK_RUNTIME_OUTPUT_DIR)/status.txt \
 437         )
 438 ifdef JCK_RUNTIME_REFERENCE
 439         JT_JAVA=$(JT_JAVA) $(JTDIFF) -o $(JCK_RUNTIME_OUTPUT_DIR)/diff.html \
 440             $(JCK_RUNTIME_REFERENCE) $(JCK_RUNTIME_OUTPUT_DIR)/report \
 441         || ( $(call EXIT_IF_FATAL,$(FATAL_JTDIFF_EXIT)) )
 442 endif
 443 
 444 jck-runtime-summary: FRC
 445         if [ -r $(JCK_RUNTIME_OUTPUT_DIR)/status.txt ]; then \
 446             echo ; echo "Summary of JCK-runtime test failures" ; \
 447             cat $(JCK_RUNTIME_OUTPUT_DIR)/report/text/summary.txt | \
 448                 grep -v 'Not run' | grep -v 'Passed' ; \
 449             echo ; \
 450             $(EXIT) `cat $(JCK_RUNTIME_OUTPUT_DIR)/status.txt` ; \
 451         fi
 452 
 453 # Check to make sure these directories exist
 454 check-jck: $(JCK_HOME) $(PRODUCT_HOME)
 455 
 456 all-summary: FRC
 457         if [ -n "`find $(TEST_OUTPUT_DIR) -name status.txt`" ]; then
 458             echo ; echo "Summary of test failures" ; \
 459             cat `find $(TEST_OUTPUT_DIR) -name summary.txt` | \
 460                 grep -v 'Not run' | grep -v 'Passed' ; \
 461             echo ; \
 462             $(EXIT) 1
 463         fi
 464 
 465 # Bundle up the results
 466 $(JPRT_ARCHIVE_BUNDLE): FRC
 467         @rm -f $@
 468         @mkdir -p $(@D)
 469         ( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
 470 
 471 # Cleanup
 472 clean:
 473         rm -f $(JPRT_ARCHIVE_BUNDLE)
 474 
 475 # Used to force a target rules to run
 476 FRC:
 477 
 478 #
 479 # Tier 1 langtools testing logic
 480 #
 481 
 482 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
 483 
 484 # How to create the test bundle (pass or fail, we want to create this)
 485 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 486 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
 487                    && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
 488                    && $(CHMOD) -R a+r . \
 489                    && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
 490 
 491 # important results files
 492 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
 493 STATS_TXT_NAME = Stats.txt
 494 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
 495 RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
 496 PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
 497 FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
 498 EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
 499 
 500 TESTEXIT = \
 501   if [ ! -s $(EXITCODE) ] ; then \
 502     $(ECHO) "ERROR: EXITCODE file not filled in."; \
 503     $(ECHO) "1" > $(EXITCODE); \
 504   fi ; \
 505   testExitCode=`$(CAT) $(EXITCODE)`; \
 506   $(ECHO) "EXIT CODE: $${testExitCode}"; \
 507   exit $${testExitCode}
 508 
 509 BUNDLE_UP_AND_EXIT = \
 510 ( \
 511   jtregExitCode=$$? && \
 512   _summary="$(SUMMARY_TXT)"; \
 513   $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
 514   $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
 515   if [ -r "$${_summary}" ] ; then \
 516     $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
 517     $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
 518     $(EGREP) ' Passed\.' $(RUNLIST) \
 519       | $(EGREP) -v ' Error\.' \
 520       | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
 521     ( $(EGREP) ' Failed\.' $(RUNLIST); \
 522       $(EGREP) ' Error\.' $(RUNLIST); \
 523       $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
 524       | $(SORT) | $(UNIQ) > $(FAILLIST); \
 525     if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
 526       $(EXPAND) $(FAILLIST) \
 527         | $(CUT) -d' ' -f1 \
 528         | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
 529       if [ $${jtregExitCode} = 0 ] ; then \
 530         jtregExitCode=1; \
 531       fi; \
 532     fi; \
 533     runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 534     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 535     failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 536     exclc="FIXME CODETOOLS-7900176"; \
 537     $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}" \
 538       >> $(STATS_TXT); \
 539   else \
 540     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
 541   fi; \
 542   if [ -f $(STATS_TXT) ] ; then \
 543     $(CAT) $(STATS_TXT); \
 544   fi; \
 545   $(ZIP_UP_RESULTS) ; \
 546   $(TESTEXIT) \
 547 )
 548 
 549 prep-tier1:
 550         @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
 551 
 552 # Run tier1 jtreg
 553 jtreg-tests-tier1: check-jtreg prep-tier1 FRC
 554         (                                                                    \
 555           ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
 556             export JT_HOME;                                                  \
 557             $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
 558           -J-Xmx512m \
 559           -vmoption:-Xmx768m \
 560           -a -ignore:quiet $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE)) \
 561               -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
 562               -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
 563               -jdk:$(shell $(GETMIXEDPATH) "$(TESTJAVA)")                    \
 564           $(JAVA_ARGS:%=-vmoption:%) \
 565           $(JTREG_OPTIONS) \
 566           :langtools_tier1 \
 567           ) ;                                                                \
 568           $(BUNDLE_UP_AND_EXIT)                                              \
 569         ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
 570 
 571 # Phony targets (e.g. these are not filenames)
 572 .PHONY: all clean \
 573         jtreg javac javadoc javah javap jdeps jtreg-tests jtreg-summary check-jtreg \
 574         jck-compiler jck-compiler-tests jck-compiler-summary \
 575         jck-runtime jck-runtime-tests jck-runtime-summary check-jck prep-tier1 \
 576         jtreg-tests-tier1 tier1
 577 
 578 # No use of suffix rules
 579 .SUFFIXES:
 580