Skip to content
Permalink
Browse files
8268626: Remove native pre-jdk9 support for jtreg failure handler
Reviewed-by: erikj
  • Loading branch information
lmesnik committed Jun 14, 2021
1 parent e59acd9 commit 2e70bc35dffce47e85f5ca4eaa4c9bdba5afb95b
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2016, 2021, 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
@@ -60,24 +60,6 @@ $(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \

TARGETS += $(BUILD_FAILURE_HANDLER)

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

ifeq ($(call isTargetOs, windows), true)

$(eval $(call SetupNativeCompilation, BUILD_LIBTIMEOUT_HANDLER, \
NAME := timeoutHandler, \
SRC := $(FH_BASEDIR)/src/windows/native/libtimeoutHandler, \
OBJECT_DIR := $(FH_SUPPORT)/libtimeoutHandler, \
OUTPUT_DIR := $(FH_SUPPORT), \
CFLAGS := $(CFLAGS_JDKLIB), \
LDFLAGS := $(LDFLAGS_JDKLIB), \
OPTIMIZATION := LOW, \
))

TARGETS += $(BUILD_LIBTIMEOUT_HANDLER)

endif

################################################################################
# Targets for building test-image.
################################################################################
@@ -99,10 +81,6 @@ IMAGES_TARGETS += $(COPY_FH)
# Use JTREG_TESTS for jtreg tests parameter
#
RUN_DIR := $(FH_SUPPORT)/test
# Add the dir of the dll to the path on windows
ifeq ($(call isTargetOs, windows), true)
export PATH := $(PATH);$(FH_SUPPORT)
endif

test:
$(RM) -r $(RUN_DIR)
@@ -53,19 +53,10 @@ SRC_DIR := $(shell cygpath -m "${SRC_DIR}")
JAVA_HOME := $(shell cygpath -m "${JAVA_HOME}")
JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}")
CLASSPATH := $(shell cygpath -pm "${CLASSPATH}")
CC := "cl.exe"
endif

all: clean test

native: require_env
ifeq ("${OS_NAME}", "Cygwin")
"${CC}" src/windows/native/jdk/test/failurehandler/jtreg/*.c \
-I"$(shell cygpath -w "${JAVA_HOME}/include")" \
-I"$(shell cygpath -w "${JAVA_HOME}/include/win32")" \
/link /DLL /OUT:timeoutHandler.dll
endif

check_defined = $(foreach 1,$1,$(__check_defined))
__check_defined = $(if $(value $1),, $(error $1 is not set))

@@ -112,7 +103,7 @@ require_env:
clean:
rm -rf "${BUILD_DIR}" "${RUN_DIR}"

build: classes native
build: classes

.PHONY: all build classes native test require_env clean
.PHONY: all build classes test require_env clean
.DEFAULT: all
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2021, 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
@@ -30,7 +30,6 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.nio.file.Path;

/**
@@ -102,33 +101,6 @@ protected void runActions(Process process, long pid)
}
}

@Override
protected long getProcessId(Process process) {
long result = super.getProcessId(process);
if (result == 0L) {
/* jtreg didn't find pid, most probably we are on JDK < 9
there is no Process::getPid */
if (HAS_NATIVE_LIBRARY && "windows".equals(OS.current().family)) {
try {
Field field = process.getClass().getDeclaredField("handle");
boolean old = field.canAccess(process);
try {
field.setAccessible(true);
long handle = field.getLong(process);
result = getWin32Pid(handle);
} finally {
field.setAccessible(old);
}
} catch (ReflectiveOperationException e) {
e.printStackTrace(log);
}
}
}
return result;
}

private native long getWin32Pid(long handle);

private void runGatherer(String name, Path workDir, PrintWriter log,
PrintWriter out, long pid) {
try (HtmlPage html = new HtmlPage(out)) {

This file was deleted.

1 comment on commit 2e70bc3

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 2e70bc3 Jun 14, 2021

Please sign in to comment.