make/RunTestsLegacy.gmk
author ihse
Thu, 30 Nov 2017 00:31:24 +0100
branchihse-testmakefiles-branch
changeset 55921 60356323be38
parent 55881 dbf68259f80e
permissions -rw-r--r--
Try to not exit with error.

#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

# In Cygwin, the MAKE variable gets prepended with the current directory if the
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
ifneq ($(findstring :, $(MAKE)), )
  MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
endif

# Locate this Makefile
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
  makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
else
  makefile_path := $(lastword $(MAKEFILE_LIST))
endif
topdir := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))

# Determine if we need a fake spec
available_specs := $(wildcard $(topdir)/build/*/*.gmk)
ifeq ($(words $(available_specs)), 1)
  # We found exactly one spec, assume we should use it
  spec := $(strip $(patsubst $(topdir)/%, %, $(available_specs)))
  $(info Using SPEC from configuration located at $(strip $(patsubst %/spec.gmk, %, $(spec))))
else
  ifeq ($(available_specs), )
    $(info No configurations found, using fake spec)
    spec := make/FakeSpecForLegacyTests.gmk
  else
    $(info Warning: Multiple configurations found, using fake spec instead!)
    $(info Please use top-level Makefile to properly select configuration)
    spec := make/FakeSpecForLegacyTests.gmk
  endif
endif

default: all

# Legacy control variables for jtreg/testing:
#  SLASH_JAVA
#  TEST_OUTPUT_DIR
#  ALT_OUTPUTDIR
#  PRODUCT_HOME
#  JAVA_ARGS
#  JPRT_PRODUCT_ARGS
#  JPRT_PRODUCT_VM_ARGS
#  TESTNATIVE_DIR
#  JPRT_ARCHIVE_BUNDLE
#  JT_HOME
#  TESTDIRS # When called from JPRT the TESTDIRS variable is set to the jtreg tests to run (=> sets this in TEST_SELECTION)
#  CONCURRENCY
#  EXTRA_JTREG_OPTIONS
#  JTREG_ASSERT_OPTION
#  JTREG_VERBOSE
#  JTREG_IGNORE_OPTION
#  JTREG_TIMEOUT_OPTION
#  JTREG_MEMORY_OPTION
#  JTREG_TESTVM_MEMORY_OPTION
#  JTREG_KEY_OPTION
#  TEST_SELECTION

################################################################################

# Langtools used to remove the prefix "langtools_" from their test names.

langtools_% :
	echo TESTS=$(addprefix langtools/test:, $(subst langtools_,,$@))

jdk_% core_%s svc_%:
	echo TESTS=$(addprefix jdk/test:, $@)

jaxp_%:
	echo TESTS=$(addprefix jaxp/test:, $@)

hotspot_%:
	echo TESTS=$(addprefix hotspot/test:, $@)

runtest:
	@cd $(topdir) && $(MAKE) -r -R -j 1 -s -I make/common/ \
	    SPEC=$(spec) TOPDIR=$(topdir) \
	    -f make/RunTests.gmk runtest TEST="tier1"

# If TEST_SELECTION is given, only use TESTDIRS to determine component.
# If TEST_SELECTION is not given, use TESTDIRS  to determine component and
# test in the component.
# TESTDIRS must begin with ../<component>/test.
# Specifying only TESTDIRS=../<component>/test (with or without trailing slash)
# is an error.
#
COMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
#ifneq ($(TEST_SELECTION), )
#  $(addprefix $(COMPONENT)/test:, $(TESTNAMES))

TESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))

jtreg_tests:
	echo TESTS=$(sort $(TESTDIRS) $(TEST_SELECTION))
	echo COMPONENT $(COMPONENT) TESTDIRS_TESTS $(TESTDIRS_TESTS)

all: runtest

.PHONY: default all