Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RID for SunOS-derived operating systems #37016

Merged
merged 4 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions eng/Configurations.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('OSX'))">OSX</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('SUNOS'))">SunOS</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('ILLUMOS'))">illumos</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('SOLARIS'))">Solaris</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSUnixLike())">Linux</TargetOS>
<TargetOS Condition="'$(TargetOS)' == '' and $([MSBuild]::IsOSPlatform('WINDOWS'))">Windows_NT</TargetOS>
<CoreCLRTargetOS Condition="'$(CoreCLRTargetOS)' == ''">$(TargetOS)</CoreCLRTargetOS>
Expand All @@ -70,4 +71,4 @@
<!-- Enable NuGet static graph evaluation to optimize incremental restore -->
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
</PropertyGroup>
</Project>
</Project>
14 changes: 8 additions & 6 deletions eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ usage()
echo " --librariesConfiguration (-lc) Libraries build configuration: Debug or Release."
echo " [Default: Debug]"
echo " --os Target operating system: Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android,"
echo " Browser, NetBSD or SunOS."
echo " Browser, NetBSD, illumos or Solaris."
echo " [Default: Your machine's OS.]"
echo " --projects <value> Project or solution file(s) to build."
echo " --runtimeConfiguration (-rc) Runtime build configuration: Debug, Release or Checked."
Expand Down Expand Up @@ -115,7 +115,7 @@ usage()

initDistroRid()
{
source $scriptroot/native/init-distro-rid.sh
source "$scriptroot"/native/init-distro-rid.sh

local passedRootfsDir=""
local targetOs="$1"
Expand Down Expand Up @@ -206,7 +206,7 @@ while [[ $# > 0 ]]; do
;;

-configuration|-c)
if [ -z ${2+x} ]; then
if [ -z ${2+x} ]; then
echo "No configuration supplied. See help (--help) for supported configurations." 1>&2
exit 1
fi
Expand Down Expand Up @@ -258,11 +258,13 @@ while [[ $# > 0 ]]; do
os="Android" ;;
browser)
os="Browser" ;;
sunos)
os="SunOS" ;;
illumos)
os="illumos" ;;
solaris)
os="Solaris" ;;
*)
echo "Unsupported target OS '$2'."
echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, and SunOS."
echo "The allowed values are Windows_NT, Linux, FreeBSD, OSX, tvOS, iOS, Android, Browser, illumos and Solaris."
exit 1
;;
esac
Expand Down
15 changes: 15 additions & 0 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,17 @@ if(CLR_CMAKE_HOST_OS STREQUAL SunOS)
clr_unknown_arch()
endif()

EXECUTE_PROCESS(
COMMAND uname -o
OUTPUT_VARIABLE SUNOS_KERNEL_KIND
ERROR_QUIET)

set(CLR_CMAKE_HOST_SUNOS 1)
if(SUNOS_KERNEL_KIND STREQUAL illumos)
set(CLR_CMAKE_HOST_OS_ILLUMOS 1)
else(SUNOS_KERNEL_KIND STREQUAL illumos)
set(CLR_CMAKE_HOST_OS_SOLARIS 1)
endif(SUNOS_KERNEL_KIND STREQUAL illumos)
endif(CLR_CMAKE_HOST_OS STREQUAL SunOS)

if(CLR_CMAKE_HOST_OS STREQUAL Windows)
Expand Down Expand Up @@ -312,6 +322,11 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL NetBSD)

if(CLR_CMAKE_TARGET_OS STREQUAL SunOS)
set(CLR_CMAKE_TARGET_UNIX 1)
if(CLR_CMAKE_HOST_OS_ILLUMOS)
set(CLR_CMAKE_TARGET_OS_ILLUMOS 1)
else(CLR_CMAKE_HOST_OS_ILLUMOS)
set(CLR_CMAKE_TARGET_OS_SOLARIS 1)
endif(CLR_CMAKE_HOST_OS_ILLUMOS)
set(CLR_CMAKE_TARGET_SUNOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL SunOS)

Expand Down
25 changes: 23 additions & 2 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ initNonPortableDistroRid()
elif getprop ro.product.system.model 2>&1 | grep -qi android; then
__android_sdk_version=$(getprop ro.build.version.sdk)
nonPortableBuildID="android.$__android_sdk_version-${buildArch}"
elif [ "$targetOs" = "illumos" ]; then
__uname_version=$(uname -v)
case "$__uname_version" in
omnios-*)
__omnios_major_version=$(echo "${__uname_version:8:2}")
nonPortableBuildID=omnios."$__omnios_major_version"-"$buildArch"
;;
joyent_*)
__smartos_major_version=$(echo "${__uname_version:7:4}")
nonPortableBuildID=smartos."$__smartos_major_version"-"$buildArch"
;;
illumos_*)
nonPortableBuildID=openindiana-"$buildArch"
;;
esac
elif [ "$targetOs" = "Solaris" ]; then
__uname_version=$(uname -v)
__solaris_major_version=$(echo "${__uname_version%.*}")
nonPortableBuildID=solaris."$__solaris_major_version"-"$buildArch"
fi

if [ -n "${nonPortableBuildID}" ]; then
Expand Down Expand Up @@ -169,8 +188,10 @@ initDistroRidGlobal()
distroRid="browser-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
elif [ "$targetOs" = "SunOS" ]; then
distroRid="sunos-$buildArch"
elif [ "$targetOs" = "illumos" ]; then
distroRid="illumos-$buildArch"
elif [ "$targetOs" = "Solaris" ]; then
distroRid="solaris-$buildArch"
fi
fi

Expand Down
9 changes: 7 additions & 2 deletions eng/native/init-os-and-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

case "$OSName" in
FreeBSD|Linux|NetBSD|OpenBSD|SunOS|Android)
os=$OSName ;;
os="$OSName" ;;
Darwin)
os=OSX ;;
*)
Expand All @@ -20,7 +20,12 @@ esac
# On Solaris, `uname -m` is discoragued, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html
# and `uname -p` returns processor type (e.g. i386 on amd64).
# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html.
if [ "$OSName" = "SunOS" ]; then
if [ "$os" = "SunOS" ]; then
if uname -o 2>&1 | grep -q illumos; then
os="illumos"
else
os="Solaris"
fi
CPUName=$(isainfo -n)
else
# For rest of the operating systems, use uname(1) to determine what the CPU is.
Expand Down
8 changes: 4 additions & 4 deletions eng/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ wait_on_pids()

usage()
{
echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD or SunOS"
echo "Runs .NET CoreFX tests on FreeBSD, Linux, NetBSD, illumos or Solaris"
echo "usage: run-test [options]"
echo
echo "Input sources:"
echo " --runtime <location> Location of root of the binaries directory"
echo " containing the FreeBSD, Linux, NetBSD or SunOS runtime"
echo " containing the FreeBSD, Linux, NetBSD, illumos or Solaris runtime"
echo " default: <repo_root>/bin/testhost/netcoreapp-<OS>-<Configuration>-<Arch>"
echo " --corefx-tests <location> Location of the root binaries location containing"
echo " the tests to run"
Expand All @@ -29,7 +29,7 @@ usage()
echo "Flavor/OS/Architecture options:"
echo " --configuration <config> Configuration to run (Debug/Release)"
echo " default: Debug"
echo " --os <os> OS to run (FreeBSD, Linux, NetBSD or SunOS)"
echo " --os <os> OS to run (FreeBSD, Linux, NetBSD, illumos or Solaris)"
echo " default: detect current OS"
echo " --arch <Architecture> Architecture to run (x64, arm, armel, x86, arm64)"
echo " default: detect current architecture"
Expand Down Expand Up @@ -254,7 +254,7 @@ then
exit 1
fi

if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "SunOS" ]
if [ "$OS" != "FreeBSD" ] && [ "$OS" != "Linux" ] && [ "$OS" != "NetBSD" ] && [ "$OS" != "illumos" ] && [ "$OS" != "Solaris" ]
then
echo "error: OS should be FreeBSD, Linux, NetBSD or Linux"
exit 1
Expand Down
13 changes: 10 additions & 3 deletions eng/targetframeworksuffix.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@
<PackageTargetRuntime>netbsd</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'SunOS'">
<When Condition="'$(TargetFrameworkSuffix)' == 'illumos'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsSunOS>true</TargetsSunOS>
<PackageTargetRuntime>sunos</PackageTargetRuntime>
<TargetsIllumos>true</TargetsIllumos>
<PackageTargetRuntime>illumos</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Solaris'">
<PropertyGroup>
<TargetsUnix>true</TargetsUnix>
<TargetsSolaris>true</TargetsSolaris>
<PackageTargetRuntime>solaris</PackageTargetRuntime>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkSuffix)' == 'Browser'">
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/dir.common.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
<TargetsFreeBSD Condition="'$(TargetOS)' == 'FreeBSD'">true</TargetsFreeBSD>
<TargetsLinux Condition="'$(TargetOS)' == 'Linux'">true</TargetsLinux>
<TargetsNetBSD Condition="'$(TargetOS)' == 'NetBSD'">true</TargetsNetBSD>
<TargetsSunOS Condition="'$(TargetOS)' == 'SunOS'">true</TargetsSunOS>
<TargetsIllumos Condition="'$(TargetOS)' == 'illumos'">true</TargetsIllumos>
<TargetsSolaris Condition="'$(TargetOS)' == 'Solaris'">true</TargetsSolaris>
<TargetsOSX Condition="'$(TargetOS)' == 'OSX'">true</TargetsOSX>
<TargetsWindows Condition="'$(TargetOS)' == 'Windows_NT'">true</TargetsWindows>

<TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsNetBSD)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsSunOS)' == 'true'">true</TargetsUnix>
<TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsNetBSD)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsIllumos)' == 'true' or '$(TargetsSolaris)' == 'true'">true</TargetsUnix>

<!-- We are only tracking Linux Distributions for Nuget RID mapping -->
<DistroRid Condition="'$(TargetsLinux)' == 'true'">$(__DistroRid)</DistroRid>
Expand Down
22 changes: 16 additions & 6 deletions src/coreclr/src/.nuget/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<RuntimeOS Condition="'$(RuntimeOS)' == ''">$(OSRid)</RuntimeOS>

<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;SunOS</SupportedPackageOSGroups>
<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Android;Linux;FreeBSD;NetBSD;illumos;Solaris</SupportedPackageOSGroups>
<SupportedPackageOSGroups>;$(SupportedPackageOSGroups);</SupportedPackageOSGroups>

<!-- Identify OS family based upon the RuntimeOS, which could be distro specific (e.g. osx.10.12) or
Expand Down Expand Up @@ -103,11 +103,18 @@
<PackageRID Condition="'$(PortableBuild)' == 'true'">netbsd-$(TargetArchitecture)</PackageRID>
</PropertyGroup>
</When>
<When Condition="'$(_runtimeOSFamily)' == 'sunos'">
<When Condition="'$(_runtimeOSFamily)' == 'illumos'">
<PropertyGroup>
<PackageRID>sunos-$(TargetArchitecture)</PackageRID>
<PackageRID>illumos-$(TargetArchitecture)</PackageRID>
<!-- Set the platform part of the RID if we are doing a portable build -->
<PackageRID Condition="'$(PortableBuild)' == 'true'">sunos-$(TargetArchitecture)</PackageRID>
<PackageRID Condition="'$(PortableBuild)' == 'true'">illumos-$(TargetArchitecture)</PackageRID>
</PropertyGroup>
</When>
<When Condition="'$(_runtimeOSFamily)' == 'solaris'">
<PropertyGroup>
<PackageRID>solaris-$(TargetArchitecture)</PackageRID>
<!-- Set the platform part of the RID if we are doing a portable build -->
<PackageRID Condition="'$(PortableBuild)' == 'true'">solaris-$(TargetArchitecture)</PackageRID>
</PropertyGroup>
</When>
<When Condition="'$(_runtimeOSFamily)' == 'android'">
Expand Down Expand Up @@ -176,8 +183,11 @@
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';NetBSD;'))">
<OfficialBuildRID Include="netbsd-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';SunOS;'))">
<OfficialBuildRID Include="sunos-x64" />
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';illumos;'))">
<OfficialBuildRID Include="illumos-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Solaris;'))">
<OfficialBuildRID Include="solaris-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Windows_NT;'))">
<OfficialBuildRID Include="win-x86">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('freebsd'))">freebsd</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('netbsd'))">netbsd</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('sunos'))">sunos</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('illumos'))">illumos</_OSPlatform>
<_OSPlatform Condition="$([MSBuild]::IsOSPlatform('solaris'))">solaris</_OSPlatform>
<_OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</_OSArchitecture>

<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(_OSPlatform)-$(_OSArchitecture.ToLower())</MicrosoftNetCoreIlasmPackageRuntimeId>
Expand Down
34 changes: 18 additions & 16 deletions src/coreclr/tests/scripts/run-pmi-diffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@
Docker_name_arm64 = 'microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-arm64-a3ae44b-20180315221921'
Docker_opts_arm64 = '-e ROOTFS_DIR=/crossrootfs/arm64'

Is_illumos = ('illumos' in subprocess.Popen(["uname", "-o"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8'))

# This should be factored out of build.sh
Unix_name_map = {
'Linux': 'Linux',
'Darwin': 'OSX',
'FreeBSD': 'FreeBSD',
'OpenBSD': 'OpenBSD',
'NetBSD': 'NetBSD',
'SunOS': 'SunOS'
'SunOS': 'illumos' if Is_illumos else 'Solaris'
}

Is_windows = (os.name == 'nt')
Expand Down Expand Up @@ -131,13 +133,13 @@ def validate_args(args):
Returns:
args (CoreclrArguments) : Args parsed
Notes:
If the arguments are valid then return them all in a tuple. If not,
If the arguments are valid then return them all in a tuple. If not,
raise an exception stating x argument is incorrect.
"""

coreclr_setup_args = CoreclrArguments(args,
require_built_test_dir=False,
require_built_core_root=True,
coreclr_setup_args = CoreclrArguments(args,
require_built_test_dir=False,
require_built_core_root=True,
require_built_product_dir=False)

coreclr_setup_args.verify(args,
Expand All @@ -161,7 +163,7 @@ def validate_args(args):
"skip_baseline_build",
lambda unused: True,
"Error setting baseline build")

coreclr_setup_args.verify(args,
"skip_diffs",
lambda unused: True,
Expand All @@ -183,15 +185,15 @@ def validate_args(args):
"Error setting ci_arch")

args = (
coreclr_setup_args.arch,
coreclr_setup_args.ci_arch,
coreclr_setup_args.build_type,
coreclr_setup_args.base_root,
coreclr_setup_args.diff_root,
coreclr_setup_args.scratch_root,
coreclr_setup_args.skip_baseline_build,
coreclr_setup_args.skip_diffs,
coreclr_setup_args.target_branch,
coreclr_setup_args.arch,
coreclr_setup_args.ci_arch,
coreclr_setup_args.build_type,
coreclr_setup_args.base_root,
coreclr_setup_args.diff_root,
coreclr_setup_args.scratch_root,
coreclr_setup_args.skip_baseline_build,
coreclr_setup_args.skip_diffs,
coreclr_setup_args.target_branch,
coreclr_setup_args.commit_hash
)

Expand Down Expand Up @@ -328,7 +330,7 @@ def baseline_build():
buildOpts = 'cross'
scriptPath = baseCoreClrPath

# Build a checked baseline jit
# Build a checked baseline jit

if Is_windows:
command = 'set __TestIntermediateDir=int&&build.cmd %s checked skiptests skipbuildpackages' % arch
Expand Down
9 changes: 7 additions & 2 deletions src/coreclr/tests/setup-stress-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ case "$OSName" in
;;

SunOS)
__TargetOS=SunOS
__HostOS=SunOS
if uname -o 2>&1 | grep -q illumos; then
__TargetOS=illumos
__HostOS=illumos
else
__TargetOS=Solaris
__HostOS=Solaris
fi
;;

*)
Expand Down
Loading