langtools/test/Makefile
author asaha
Tue, 06 Oct 2009 21:40:55 -0700
changeset 4209 e2e5a973b879
parent 3779 8b3fc577aec6
child 5214 b71be6b1f652
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
# Makefile to run jtreg and any other tests
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
# Get OS/ARCH specifics
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
OSNAME = $(shell uname -s)
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
ifeq ($(OSNAME), SunOS)
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
  PLATFORM = solaris
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
  JT_PLATFORM = solaris
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
  ARCH = $(shell uname -p)
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
  ifeq ($(ARCH), i386)
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    ARCH=i586
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
ifeq ($(OSNAME), Linux)
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
  PLATFORM = linux
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
  JT_PLATFORM = linux
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
  ARCH = $(shell uname -m)
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
  ifeq ($(ARCH), i386)
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
    ARCH=i586
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
ifeq ($(OSNAME), Windows_NT)
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
  PLATFORM = windows
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
  JT_PLATFORM = win32
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
  ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
    ARCH=ia64
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
  else
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
    ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
      ARCH=x64
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
    else
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
      ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
        ARCH=x64
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
      else
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
        ARCH=i586
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
      endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
    endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
# Root of this test area (important to use full paths in some places)
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
TEST_ROOT := $(shell pwd)
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
# Default bundle of all test results (passed or not)
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
ifeq ($(PLATFORM), windows)
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
  SLASH_JAVA = J:
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
  SLASH_JAVA = /java
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
# Default JTREG to run
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    54
ifdef JPRT_JTREG_HOME
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    55
  JTREG_HOME = $(JPRT_JTREG_HOME)
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    56
else
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    57
  JTREG_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    58
endif
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    59
JTREG = $(JTREG_HOME)/$(JT_PLATFORM)/bin/jtreg
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
# Default JDK for JTREG
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
ifdef JPRT_JAVA_HOME
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
  JT_JAVA = $(JPRT_JAVA_HOME)
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
  JT_JAVA = $(SLASH_JAVA)/re/jdk/1.6.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
# Default JDK to test
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    69
ifdef JPRT_IMPORT_PRODUCT_HOME
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    70
  TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME)
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    71
else
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    72
  TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH)
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    73
endif
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    74
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
TESTBOOTCLASSPATH = $(PRODUCT_HOME)/dist/lib/classes.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
# The test directories to run
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
DEFAULT_TESTDIRS = .
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
TESTDIRS = $(DEFAULT_TESTDIRS)
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
# Root of all test results
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
TEST_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH)
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
# Default make rule
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    85
all apt javac javadoc javah javap: clean check jtreg-tests $(JPRT_ARCHIVE_BUNDLE)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
	@echo "Testing completed successfully"
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
# for use with JPRT -testrule
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
all:		TESTDIRS = .
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    90
apt:		TESTDIRS = tools/apt
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
    91
javac: 		TESTDIRS = tools/javac
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
javadoc:	TESTDIRS = tools/javadoc com/sun/javadoc
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
javah:		TESTDIRS = tools/javah
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
javap:		TESTDIRS = tools/javap
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
# Check to make sure these directories exist
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
check: $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
# Run the tests
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
jtreg-tests: FRC
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
	@echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)"
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
	@rm -f -r $(TEST_OUTPUT_DIR)/JTwork $(TEST_OUTPUT_DIR)/JTreport
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
	@mkdir -p $(TEST_OUTPUT_DIR)
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   104
	JT_JAVA=$(JT_JAVA) $(JTREG) \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   105
	  -a -samevm -k:\!ignore -v:fail,error,nopass \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
          -r:$(TEST_OUTPUT_DIR)/JTreport \
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
          -w:$(TEST_OUTPUT_DIR)/JTwork \
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
          -jdk:$(TESTJAVA) \
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
	  -Xbootclasspath/p:$(TESTBOOTCLASSPATH) \
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
          $(JAVA_ARGS:%=-vmoption:%) \
3779
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   111
          $(TESTDIRS) \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   112
	|| ( status=$$? ; \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   113
		echo ; echo "Summary of test failures" ; \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   114
		cat $(TEST_OUTPUT_DIR)/JTreport/text/summary.txt | \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   115
			grep -v 'Not run' | grep -v 'Passed' ; \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   116
		echo ; \
8b3fc577aec6 6877763: update langtools/test/Makefile for JPRT
jjg
parents: 1261
diff changeset
   117
		exit $$status )
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
# Bundle up the results
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
$(JPRT_ARCHIVE_BUNDLE): FRC
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
	@rm -f $@
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
	@mkdir -p $(@D)
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
	( cd $(TEST_OUTPUT_DIR) && zip -q -r $@ . )
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
# Cleanup
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
clean:
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
	rm -f -r $(TEST_OUTPUT_DIR)
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
	rm -f $(JPRT_ARCHIVE_BUNDLE)
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
# Used to force a target rules to run
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
FRC:
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
# Phony targets (e.g. these are not filenames)
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
.PHONY: all tests clean check
06bc494ca11e Initial load
duke
parents:
diff changeset
   135