Windows Support: Testing Suite integration

Broaden support for execution of the test suite
on Windows.
General bug and review fixups
This commit is contained in:
John Parent
2022-03-16 16:41:34 -04:00
committed by Peter Scheibel
parent e63b4f752a
commit 4aee27816e
102 changed files with 771 additions and 1066 deletions

View File

@@ -94,6 +94,8 @@ def install(self, spec, prefix):
# check that which('cmake') returns the right one.
cmake = which('cmake')
print(cmake)
print(cmake.exe)
check(cmake.exe[0].startswith(spec['cmake'].prefix.bin),
"Wrong cmake was in environment: %s" % cmake)

View File

@@ -4,9 +4,12 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import sys
from spack import *
is_windows = sys.platform == 'win32'
def check(condition, msg):
"""Raise an install error if condition is False."""
@@ -43,7 +46,7 @@ def install(self, spec, prefix):
check(os.environ['for_install'] == 'for_install',
"Couldn't read env var set in compile envieonmnt")
cmake_exe = join_path(prefix.bin, 'cmake')
cmake_exe_ext = ".exe" if is_windows else ''
cmake_exe = join_path(prefix.bin, 'cmake{}'.format(cmake_exe_ext))
touch(cmake_exe)
set_executable(cmake_exe)

View File

@@ -20,11 +20,11 @@ def determine_spec_details(cls, prefix, exes_in_prefix):
exe_to_path = dict(
(os.path.basename(p), p) for p in exes_in_prefix
)
if 'find-externals1-exe' not in exe_to_path:
return None
exes = [x for x in exe_to_path.keys() if 'find-externals1-exe' in x]
if not exes:
return
exe = spack.util.executable.Executable(
exe_to_path['find-externals1-exe'])
exe_to_path[exes[0]])
output = exe('--version', output=str)
if output:
match = re.search(r'find-externals1.*version\s+(\S+)', output)

View File

@@ -2,7 +2,6 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
@@ -15,6 +14,4 @@ class TrivialInstallTestPackage(Package):
version('1.0', '0123456789abcdef0123456789abcdef')
def install(self, spec, prefix):
configure('--prefix=%s' % prefix)
make()
make('install')
touch(join_path(prefix, 'an_installation_file'))

View File

@@ -5,7 +5,6 @@
import os
import re
import sys
import llnl.util.tty as tty
@@ -98,8 +97,6 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package
depends_on('perl@5.14.0:', type=('build', 'test'))
depends_on('ca-certificates-mozilla', type=('build', 'run'), when='certs=mozilla')
conflicts('+dynamic', when=sys.platform != 'win32')
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('version', output=str, error=str)
@@ -141,39 +138,32 @@ def install(self, spec, prefix):
options.append('-D__STDC_NO_ATOMICS__')
# Make a flag for shared library builds
shared_flag = ''
if spec.satisfies('~shared'):
shared_flag = 'no-shared'
def configure_args():
base_args = ['--prefix=%s' % prefix,
'--openssldir=%s'
% join_path(prefix, 'etc', 'openssl')]
if spec.satisfies('platform=windows'):
base_args.extend([
'CC=%s' % os.environ.get('CC'),
'CXX=%s' % os.environ.get('CXX'),
'%s' % shared_flag,
'VC-WIN64A',
])
base_args.insert(0, 'Configure')
else:
base_args.extend(
[
'-I{0}'.format(self.spec['zlib'].prefix.include),
'-L{0}'.format(self.spec['zlib'].prefix.lib)
]
)
base_args.extend(options)
return base_args
base_args = ['--prefix=%s' % prefix,
'--openssldir=%s'
% join_path(prefix, 'etc', 'openssl')]
if spec.satisfies('platform=windows'):
base_args.extend([
'CC=%s' % os.environ.get('CC'),
'CXX=%s' % os.environ.get('CXX'),
'VC-WIN64A',
])
if spec.satisfies('~shared'):
base_args.append('no-shared')
else:
base_args.extend(
[
'-I{0}'.format(self.spec['zlib'].prefix.include),
'-L{0}'.format(self.spec['zlib'].prefix.lib)
]
)
base_args.extend(options)
# On Windows, we use perl for configuration and build through MSVC
# nmake.
if spec.satisfies('platform=windows'):
config = Executable('perl')
Executable('perl')('Configure', *base_args)
else:
config = Executable('./config')
Executable('./config')(*base_args)
config(*configure_args())
# Remove non-standard compiler options if present. These options are
# present e.g. on Darwin. They are non-standard, i.e. most compilers
# (e.g. gcc) will not accept them.
@@ -183,10 +173,6 @@ def configure_args():
# This variant only makes sense for Windows
if spec.satisfies('platform=windows'):
filter_file(r'MT', 'MD', 'makefile')
else:
tty.warn("Dynamic runtime builds are only available for "
"Windows operating systems. Please disable "
"+dynamic to suppress this warning.")
if spec.satisfies('platform=windows'):
host_make = nmake

View File

@@ -4,17 +4,16 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
import inspect
import json
import os
import platform
import re
import subprocess
import sys
from distutils.dir_util import copy_tree
from shutil import copy
import llnl.util.tty as tty
from llnl.util.filesystem import get_filetype, path_contains_subdirectory
from llnl.util.filesystem import copy_tree, get_filetype, path_contains_subdirectory
from llnl.util.lang import match_predicate
from spack import *
@@ -46,7 +45,6 @@ class Python(Package):
version('3.10.0', sha256='c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758')
version('3.9.10', sha256='1aa9c0702edbae8f6a2c95f70a49da8420aaa76b7889d3419c186bfc8c0e571e', preferred=True)
version('3.9.9', sha256='2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea')
version('3.9.9', sha256='2cc7b67c1f3f66c571acc42479cdf691d8ed6b47bee12c9b68430413a17a44ea')
version('3.9.8', sha256='7447fb8bb270942d620dd24faa7814b1383b61fa99029a240025fd81c1db8283')
version('3.9.7', sha256='a838d3f9360d157040142b715db34f0218e535333696a5569dc6f854604eb9d1')
version('3.9.6', sha256='d0a35182e19e416fc8eae25a3dcd4d02d4997333e4ad1f2eee6010aadc3fe866')
@@ -226,7 +224,6 @@ class Python(Package):
patch('python-3.7.4+-distutils-C++.patch', when='@3.7.4:')
patch('python-3.7.4+-distutils-C++-testsuite.patch', when='@3.7.4:')
patch('cpython-windows-externals.patch', when='@:3.9.6 platform=windows')
patch('tkinter.patch', when='@:2.8,3.3:3.7 platform=darwin')
# Patch the setup script to deny that tcl/x11 exists rather than allowing
# autodetection of (possibly broken) system components
@@ -680,7 +677,7 @@ def build(self, spec, prefix):
# See https://autotools.io/automake/silent.html
params = ['V=1']
params += self.build_targets
inspect.getmodule(self).make(*params)
make(*params)
def install(self, spec, prefix):
"""Makes the install targets specified by
@@ -690,7 +687,7 @@ def install(self, spec, prefix):
if is_windows:
self.win_installer(prefix)
else:
inspect.getmodule(self).make(*self.install_targets)
make(*self.install_targets)
@run_after('install')
def filter_compilers(self):
@@ -909,7 +906,6 @@ def config_vars(self):
Returns:
dict: variable definitions
"""
cmd = """
import json
from sysconfig import (

View File

@@ -6,8 +6,6 @@
import glob
import re
import time
from fcntl import F_GETFL, F_SETFL, fcntl
from os import O_NONBLOCK
from os.path import basename
from subprocess import PIPE, Popen
from sys import platform, stdout
@@ -20,9 +18,7 @@
if not is_windows:
from fcntl import F_GETFL, F_SETFL, fcntl
from os import O_NONBLOCK, rename
else:
from os import rename
from os import O_NONBLOCK
re_optline = re.compile(r'\s+[0-9]+\..*\((serial|smpar|dmpar|dm\+sm)\)\s+')
re_paroptname = re.compile(r'\((serial|smpar|dmpar|dm\+sm)\)')