Skip to content

Commit

Permalink
Fix CoreCLR test build for SunOS (dotnet#37824)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jun 24, 2020
1 parent d908270 commit d65dd30
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,6 @@

<PropertyGroup>
<LiveRuntimeIdentifierGraphPath>$(RuntimeIdGraphDefinitionFile)</LiveRuntimeIdentifierGraphPath>
<RuntimeIdentifierGraphPath Condition="'$(UseLiveRuntimeIdentifierGraph)' == 'true'">$(LiveRuntimeIdentifierGraphPath)</RuntimeIdentifierGraphPath>
<BundledRuntimeIdentifierGraphFile>$(LiveRuntimeIdentifierGraphPath)</BundledRuntimeIdentifierGraphFile>
</PropertyGroup>
</Project>
7 changes: 5 additions & 2 deletions src/coreclr/scripts/coreclr_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self,

self.valid_arches = ["x64", "x86", "arm", "arm64"]
self.valid_build_types = ["Debug", "Checked", "Release"]
self.valid_host_os = ["Windows_NT", "OSX", "Linux"]
self.valid_host_os = ["Windows_NT", "OSX", "Linux", "illumos", "Solaris"]

self.__initialize__(args)

Expand Down Expand Up @@ -183,8 +183,11 @@ def provide_default_host_os():
return "OSX"
elif sys.platform == "win32":
return "Windows_NT"
elif sys.platform.startswith("sunos"):
is_illumos = ('illumos' in subprocess.Popen(["uname", "-o"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8'))
return 'illumos' if is_illumos else 'Solaris'
else:
print("Unknown OS: %s" % self.host_os)
print("Unknown OS: %s" % sys.platform)
sys.exit(1)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tests/external/external.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
</ItemGroup>
</Target>

<Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="CoreCompile">
Expand Down
6 changes: 5 additions & 1 deletion src/coreclr/tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ function check_cpu_architecture {
local CPUName=$(uname -m)
local __arch=

if [[ "$(uname -s)" == "SunOS" ]]; then
CPUName=$(isainfo -n)
fi

case $CPUName in
i686)
__arch=x86
;;
x86_64)
amd64|x86_64)
__arch=x64
;;
armv7l)
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tests/src/Common/ilasm/ilasm.ilproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<ProjectAssetsFile>$(TestSourceDir)Common\ilasm\obj\project.assets.json</ProjectAssetsFile>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" />
</Project>
4 changes: 2 additions & 2 deletions src/coreclr/tests/src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
<!-- Filter .dylib files on OSX -->
<NativeProjectBinariesDyLibFilter Condition="'$(TargetOS)' == 'OSX' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.dylib`))" Include="@(NativeProjectBinariesMatched)" />

<!-- Filter .so files on Linux -->
<NativeProjectBinariesDyLibFilter Condition="'$(TargetOS)' == 'Linux' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.so`))" Include="@(NativeProjectBinariesMatched)" />
<!-- Filter .so files on non-OSX Unix -->
<NativeProjectBinariesDyLibFilter Condition="'$(RunningOnUnix)' == 'true' and '$(TargetOS)' != 'OSX' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.so`))" Include="@(NativeProjectBinariesMatched)" />

<!-- Filter static lib files on Unix -->
<NativeProjectBinariesStaticLibFilter Condition="'$(RunningOnUnix)' == 'true' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.a`))" Include="@(NativeProjectBinariesMatched)" />
Expand Down
11 changes: 6 additions & 5 deletions src/coreclr/tests/src/profiler/native/profilerstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <cstring>
#include <string>

#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#ifdef _WIN32
#define WCHAR(str) L##str
#define CAST_CHAR(ch) ch

#else // defined(_WIN32)

// Definitely won't work for non-ascii characters so hopefully we never start using
// them in the tests
Expand Down Expand Up @@ -56,10 +60,7 @@ inline int wcscmp(const char16_t *lhs, const char16_t *rhs)
return lhs[i] - rhs[i];
}

#else // defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#define WCHAR(str) L##str
#define CAST_CHAR(ch) ch
#endif // defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#endif // defined(__WIN32)

// 16 bit string type that works cross plat and doesn't require changing widths
// on non-windows platforms
Expand Down
6 changes: 2 additions & 4 deletions src/coreclr/tryrun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS)
set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1)
set_cache_value(HAVE_PROCFS_MAPS 0)
set_cache_value(HAVE_PROCFS_STAT 0)
set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 0)
set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
set_cache_value(GETPWUID_R_SETS_ERRNO 0)
set_cache_value(UNGETC_NOT_RETURN_EOF 0)
set_cache_value(HAVE_COMPATIBLE_ILOGBNAN 1)
Expand All @@ -82,9 +82,7 @@ if(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS)
set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 1)
set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 1)
set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 1)
set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 1)
set_cache_value(HAVE_PROCFS_CTL_EXITCODE 0)
set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1)
set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 1)
set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 0)
Expand Down

0 comments on commit d65dd30

Please sign in to comment.