Skip to content

Commit d29c78d

Browse files
committed
8257679: Improved unix compatibility layer in Windows build (winenv)
Reviewed-by: erikj, jvernee, burban
1 parent 74be819 commit d29c78d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1715
-2299
lines changed

.github/workflows/submit.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,15 +938,18 @@ jobs:
938938
run: >
939939
$env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
940940
$env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
941+
$env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ;
942+
$env:JT_HOME = cygpath "$HOME/jtreg" ;
943+
$env:GTEST = cygpath "$env:GITHUB_WORKSPACE/gtest" ;
941944
& bash configure
942945
--with-conf-name=windows-x64
943946
--with-msvc-toolset-version=14.27
944947
${{ matrix.flags }}
945948
--with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA"
946949
--with-version-build=0
947-
--with-boot-jdk="$HOME/bootjdk/$env:BOOT_JDK_VERSION"
948-
--with-jtreg="$HOME/jtreg"
949-
--with-gtest="$env:GITHUB_WORKSPACE/gtest"
950+
--with-boot-jdk="$env:BOOT_JDK"
951+
--with-jtreg="$env:JT_HOME"
952+
--with-gtest="$env:GTEST"
950953
--with-default-make-target="product-bundles test-bundles"
951954
--enable-jtreg-failure-handler
952955
working-directory: jdk

make/GenerateLinkOptData.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endif
6161

6262
# Save the stderr output of the command and print it along with stdout in case
6363
# something goes wrong.
64-
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
64+
$(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
6565
$(call MakeDir, $(LINK_OPT_DIR))
6666
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@))
6767
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
@@ -94,7 +94,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
9494
# dependencies, make will correctly rebuild both jli trace and classlist
9595
# incrementally using the single recipe above.
9696
$(CLASSLIST_FILE): $(JLI_TRACE_FILE)
97-
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR)
97+
$(JLI_TRACE_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST_JAR)
9898

9999
TARGETS += $(CLASSLIST_FILE) $(JLI_TRACE_FILE)
100100

make/InterimImage.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@ include Modules.gmk
3232
################################################################################
3333

3434
# Use this file inside the image as target for make rule
35-
JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
35+
JIMAGE_TARGET_FILE := bin/java$(EXECUTABLE_SUFFIX)
3636

3737
INTERIM_MODULES_LIST := $(call CommaList, $(INTERIM_IMAGE_MODULES))
3838

make/RunTests.gmk

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,14 @@ define SetTestOpt
6060
endif
6161
endef
6262

63-
# Setup _NT_SYMBOL_PATH on Windows
63+
# Setup _NT_SYMBOL_PATH on Windows, which points to our pdb files.
6464
ifeq ($(call isTargetOs, windows), true)
6565
ifndef _NT_SYMBOL_PATH
66-
# Can't use PathList here as it adds quotes around the value.
67-
_NT_SYMBOL_PATH := \
68-
$(subst $(SPACE),;,$(strip \
69-
$(foreach p, $(sort $(dir $(wildcard \
70-
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), \
71-
$(call FixPath, $p) \
72-
) \
73-
))
74-
export _NT_SYMBOL_PATH
75-
$(call LogDebug, Rewriting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH))
66+
SYMBOL_PATH := $(call PathList, $(sort $(patsubst %/, %, $(dir $(wildcard \
67+
$(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb))))))
68+
export _NT_SYMBOL_PATH := $(subst \\,\, $(call FixPath, \
69+
$(subst $(DQUOTE),, $(SYMBOL_PATH))))
70+
$(call LogDebug, Setting _NT_SYMBOL_PATH to $(_NT_SYMBOL_PATH))
7671
endif
7772
endif
7873

make/RunTestsPrebuilt.gmk

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,9 @@ ifeq ($(OPENJDK_TARGET_CPU), x86_64)
189189
endif
190190

191191
ifeq ($(OPENJDK_TARGET_OS), windows)
192-
ifeq ($(wildcard $(TEST_IMAGE_DIR)/bin/fixpath.exe), )
193-
$(info Error: fixpath is missing from test image '$(TEST_IMAGE_DIR)')
194-
$(error Cannot continue.)
195-
endif
196-
FIXPATH := $(TEST_IMAGE_DIR)/bin/fixpath.exe -c
197-
PATH_SEP:=;
192+
FIXPATH := $(BASH) $(TOPDIR)/make/scripts/fixpath.sh exec
198193
else
199194
FIXPATH :=
200-
PATH_SEP:=:
201195
endif
202196

203197
# Check number of cores and memory in MB
@@ -280,7 +274,6 @@ $(call CreateNewSpec, $(NEW_SPEC), \
280274
BASH := $(BASH), \
281275
JIB_JAR := $(JIB_JAR), \
282276
FIXPATH := $(FIXPATH), \
283-
PATH_SEP := $(PATH_SEP), \
284277
OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
285278
OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
286279
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \

make/RunTestsPrebuiltSpec.gmk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,13 @@ JAVAC_CMD := $(BOOT_JDK)/bin/javac
116116
JAR_CMD := $(BOOT_JDK)/bin/jar
117117
JLINK_CMD := $(JDK_OUTPUTDIR)/bin/jlink
118118
JMOD_CMD := $(JDK_OUTPUTDIR)/bin/jmod
119-
JARSIGNER_CMD := $(BOOT_JDK)/bin/jarsigner
120119

121120
JAVA := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
122121
JAVA_SMALL := $(FIXPATH) $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
123-
JAVA_DETACH := $(FIXPATH) $(FIXPATH_DETACH_FLAG) $(JAVA_CMD) $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
124122
JAVAC := $(FIXPATH) $(JAVAC_CMD)
125123
JAR := $(FIXPATH) $(JAR_CMD)
126124
JLINK := $(FIXPATH) $(JLINK_CMD)
127125
JMOD := $(FIXPATH) $(JMOD_CMD)
128-
JARSIGNER := $(FIXPATH) $(JARSIGNER_CMD)
129126

130127
BUILD_JAVA := $(JDK_IMAGE_DIR)/bin/JAVA
131128
################################################################################
@@ -166,7 +163,6 @@ TAIL := tail
166163
TEE := tee
167164
TR := tr
168165
TOUCH := touch
169-
UNIQ := uniq
170166
WC := wc
171167
XARGS := xargs
172168
ZIPEXE := zip
@@ -177,7 +173,7 @@ HG := hg
177173
ULIMIT := ulimit
178174

179175
ifeq ($(OPENJDK_BUILD_OS), windows)
180-
CYGPATH := cygpath
176+
PATHTOOL := cygpath
181177
endif
182178

183179
################################################################################

make/TestImage.gmk

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,15 @@ include MakeBase.gmk
3030

3131
############################################################################
3232

33-
ifeq ($(call isTargetOs, windows), true)
34-
FIXPATH_COPY := $(TEST_IMAGE_DIR)/bin/fixpath.exe
35-
36-
$(FIXPATH_COPY): $(firstword $(FIXPATH))
37-
$(call install-file)
38-
39-
FIXPATH_WORKSPACE_ROOT := $(call FixPath, $(WORKSPACE_ROOT))
40-
FIXPATH_OUTPUTDIR := $(call FixPath, $(OUTPUTDIR))
41-
else
42-
FIXPATH_WORKSPACE_ROOT := $(WORKSPACE_ROOT)
43-
FIXPATH_OUTPUTDIR := $(OUTPUTDIR)
44-
endif
45-
46-
4733
BUILD_INFO_PROPERTIES := $(TEST_IMAGE_DIR)/build-info.properties
4834

4935
$(BUILD_INFO_PROPERTIES):
5036
$(call MakeTargetDir)
5137
$(ECHO) "# Build info properties for JDK tests" > $@
52-
$(ECHO) "build.workspace.root=$(FIXPATH_WORKSPACE_ROOT)" >> $@
53-
$(ECHO) "build.output.root=$(FIXPATH_OUTPUTDIR)" >> $@
38+
$(ECHO) "build.workspace.root=$(call FixPath, $(WORKSPACE_ROOT))" >> $@
39+
$(ECHO) "build.output.root=$(call FixPath, $(OUTPUTDIR))" >> $@
5440

55-
prepare-test-image: $(FIXPATH_COPY) $(BUILD_INFO_PROPERTIES)
41+
prepare-test-image: $(BUILD_INFO_PROPERTIES)
5642
$(call MakeDir, $(TEST_IMAGE_DIR))
5743
$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
5844

make/autoconf/basic.m4

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,28 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
7070
fi
7171
7272
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
73-
PATH_SEP=";"
74-
EXE_SUFFIX=".exe"
75-
BASIC_CHECK_PATHS_WINDOWS
76-
else
77-
PATH_SEP=":"
78-
EXE_SUFFIX=""
73+
BASIC_SETUP_PATHS_WINDOWS
7974
fi
80-
AC_SUBST(PATH_SEP)
81-
AC_SUBST(EXE_SUFFIX)
8275
8376
# We get the top-level directory from the supporting wrappers.
77+
BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source)
78+
UTIL_FIXUP_PATH(TOPDIR)
8479
AC_MSG_CHECKING([for top-level directory])
8580
AC_MSG_RESULT([$TOPDIR])
8681
AC_SUBST(TOPDIR)
87-
AC_SUBST(CONFIGURE_START_DIR)
88-
89-
# We can only call UTIL_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
90-
UTIL_FIXUP_PATH(TOPDIR)
91-
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
9282
9383
if test "x$CUSTOM_ROOT" != x; then
84+
BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root)
9485
UTIL_FIXUP_PATH(CUSTOM_ROOT)
9586
WORKSPACE_ROOT="${CUSTOM_ROOT}"
9687
else
9788
WORKSPACE_ROOT="${TOPDIR}"
9889
fi
9990
AC_SUBST(WORKSPACE_ROOT)
10091
92+
UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
93+
AC_SUBST(CONFIGURE_START_DIR)
94+
10195
# Locate the directory of this script.
10296
AUTOCONF_DIR=$TOPDIR/make/autoconf
10397
@@ -234,9 +228,12 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
234228
# if no Xcode installed, xcodebuild exits with 1
235229
# if Xcode is installed, even if xcode-select is misconfigured, then it exits with 0
236230
if test "x$DEVKIT_ROOT" != x || /usr/bin/xcodebuild -version >/dev/null 2>&1; then
237-
# We need to use xcodebuild in the toolchain dir provided by the user, this will
238-
# fall back on the stub binary in /usr/bin/xcodebuild
239-
AC_PATH_PROG([XCODEBUILD], [xcodebuild], [/usr/bin/xcodebuild], [$TOOLCHAIN_PATH])
231+
# We need to use xcodebuild in the toolchain dir provided by the user
232+
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH)
233+
if test x$XCODEBUILD = x; then
234+
# fall back on the stub binary in /usr/bin/xcodebuild
235+
XCODEBUILD=/usr/bin/xcodebuild
236+
fi
240237
else
241238
# this should result in SYSROOT being empty, unless --with-sysroot is provided
242239
# when only the command line tools are installed there are no SDKs, so headers
@@ -306,6 +303,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
306303
AC_MSG_RESULT([$SYSROOT])
307304
AC_MSG_CHECKING([for toolchain path])
308305
AC_MSG_RESULT([$TOOLCHAIN_PATH])
306+
AC_SUBST(TOOLCHAIN_PATH)
309307
AC_MSG_CHECKING([for extra path])
310308
AC_MSG_RESULT([$EXTRA_PATH])
311309
])
@@ -380,6 +378,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
380378
AC_MSG_CHECKING([what configuration name to use])
381379
AC_MSG_RESULT([$CONF_NAME])
382380
381+
BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output)
383382
UTIL_FIXUP_PATH(OUTPUTDIR)
384383
385384
CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
@@ -416,26 +415,16 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
416415
# df -l lists only local disks; if the given directory is not found then
417416
# a non-zero exit code is given
418417
if test "x$DF" = x; then
419-
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
420-
# msys does not have df; use Windows "net use" instead.
421-
IS_NETWORK_DISK=`net use | grep \`pwd -W | cut -d ":" -f 1 | tr a-z A-Z\`:`
422-
if test "x$IS_NETWORK_DISK" = x; then
423-
$2
424-
else
425-
$3
426-
fi
427-
else
428-
# No df here, say it's local
429-
$2
430-
fi
418+
# No df here, say it's local
419+
$2
431420
else
432421
# JDK-8189619
433422
# df on AIX does not understand -l. On modern AIXes it understands "-T local" which
434423
# is the same. On older AIXes we just continue to live with a "not local build" warning.
435424
if test "x$OPENJDK_TARGET_OS" = xaix; then
436425
DF_LOCAL_ONLY_OPTION='-T local'
437-
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
438-
# In WSL, we can only build on a drvfs file system (that is, a mounted real Windows drive)
426+
elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
427+
# In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive)
439428
DF_LOCAL_ONLY_OPTION='-t drvfs'
440429
else
441430
DF_LOCAL_ONLY_OPTION='-l'

0 commit comments

Comments
 (0)