Skip to content

Commit f355069

Browse files
paulmonzooba
authored andcommitted
bpo-36511: Add buildbot scripts and fix tests for Windows ARM32 buildbot (pythonGH-13454)
1 parent 12f1c72 commit f355069

File tree

8 files changed

+107
-13
lines changed

8 files changed

+107
-13
lines changed

Lib/test/support/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ def _is_gui_available():
485485
if hasattr(_is_gui_available, 'result'):
486486
return _is_gui_available.result
487487
reason = None
488-
if sys.platform.startswith('win'):
488+
if sys.platform.startswith('win') and platform.win32_is_iot():
489+
reason = "gui is not available on Windows IoT Core"
490+
elif sys.platform.startswith('win'):
489491
# if Python is running as a service (such as the buildbot service),
490492
# gui interaction may be disallowed
491493
import ctypes

Lib/test/test_math.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ def testCos(self):
468468
self.assertRaises(ValueError, math.cos, NINF)
469469
self.assertTrue(math.isnan(math.cos(NAN)))
470470

471+
@unittest.skipIf(sys.platform == 'win32' and platform.machine() in ('ARM', 'ARM64'),
472+
"Windows UCRT is off by 2 ULP this test requires accuracy within 1 ULP")
471473
def testCosh(self):
472474
self.assertRaises(TypeError, math.cosh)
473475
self.ftest('cosh(0)', math.cosh(0), 1)

Lib/test/test_pyexpat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from io import BytesIO
55
import os
6+
import platform
67
import sys
78
import sysconfig
89
import unittest
@@ -465,7 +466,7 @@ def test_exception(self):
465466
"pyexpat.c", "StartElement")
466467
self.check_traceback_entry(entries[2],
467468
"test_pyexpat.py", "StartElementHandler")
468-
if sysconfig.is_python_build():
469+
if sysconfig.is_python_build() and not (sys.platform == 'win32' and platform.machine() == 'ARM'):
469470
self.assertIn('call_with_frame("StartElement"', entries[1][3])
470471

471472

Lib/test/test_regrtest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ def test_tools_buildbot_test(self):
618618
test_args = ['--testdir=%s' % self.tmptestdir]
619619
if platform.machine() == 'ARM64':
620620
test_args.append('-arm64') # ARM 64-bit build
621+
elif platform.machine() == 'ARM':
622+
test_args.append('-arm32') # 32-bit ARM build
621623
elif platform.architecture()[0] == '64bit':
622624
test_args.append('-x64') # 64-bit build
623625
if not Py_DEBUG:
@@ -633,6 +635,8 @@ def test_pcbuild_rt(self):
633635
rt_args = ["-q"] # Quick, don't run tests twice
634636
if platform.machine() == 'ARM64':
635637
rt_args.append('-arm64') # ARM 64-bit build
638+
elif platform.machine() == 'ARM':
639+
rt_args.append('-arm32') # 32-bit ARM build
636640
elif platform.architecture()[0] == '64bit':
637641
rt_args.append('-x64') # 64-bit build
638642
if Py_DEBUG:

Lib/test/test_ssl.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
from ssl import TLSVersion, _TLSContentType, _TLSMessageType, _TLSAlertType
3030

31+
Py_DEBUG = hasattr(sys, 'gettotalrefcount')
32+
Py_DEBUG_WIN32 = Py_DEBUG and sys.platform == 'win32'
33+
3134
PROTOCOLS = sorted(ssl._PROTOCOL_NAMES)
3235
HOST = support.HOST
3336
IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL')
@@ -1347,6 +1350,7 @@ def test_load_verify_cadata(self):
13471350
ctx.load_verify_locations(cadata=b"broken")
13481351

13491352

1353+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
13501354
def test_load_dh_params(self):
13511355
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
13521356
ctx.load_dh_params(DHFILE)
@@ -1665,6 +1669,7 @@ def test_str(self):
16651669
self.assertEqual(str(e), "foo")
16661670
self.assertEqual(e.errno, 1)
16671671

1672+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
16681673
def test_lib_reason(self):
16691674
# Test the library and reason attributes
16701675
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
@@ -3845,6 +3850,7 @@ def test_compression_disabled(self):
38453850
sni_name=hostname)
38463851
self.assertIs(stats['compression'], None)
38473852

3853+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
38483854
def test_dh_params(self):
38493855
# Check we can get a connection with ephemeral Diffie-Hellman
38503856
client_context, server_context, hostname = testing_context()
@@ -4440,6 +4446,7 @@ def keylog_lines(self, fname=support.TESTFN):
44404446
return len(list(f))
44414447

44424448
@requires_keylog
4449+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
44434450
def test_keylog_defaults(self):
44444451
self.addCleanup(support.unlink, support.TESTFN)
44454452
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
@@ -4463,6 +4470,7 @@ def test_keylog_defaults(self):
44634470
ctx.keylog_filename = 1
44644471

44654472
@requires_keylog
4473+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
44664474
def test_keylog_filename(self):
44674475
self.addCleanup(support.unlink, support.TESTFN)
44684476
client_context, server_context, hostname = testing_context()
@@ -4500,6 +4508,7 @@ def test_keylog_filename(self):
45004508
@requires_keylog
45014509
@unittest.skipIf(sys.flags.ignore_environment,
45024510
"test is not compatible with ignore_environment")
4511+
@unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows")
45034512
def test_keylog_env(self):
45044513
self.addCleanup(support.unlink, support.TESTFN)
45054514
with unittest.mock.patch.dict(os.environ):

Tools/buildbot/remoteDeploy.bat

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@echo off
2+
rem Used by the buildbot "remotedeploy" step.
3+
setlocal
4+
5+
set here=%~dp0
6+
set arm32_ssh=
7+
8+
:CheckOpts
9+
if "%1"=="-arm32" (set arm32_ssh=true) & shift & goto CheckOpts
10+
if NOT "%1"=="" (echo unrecognized option %1) & goto Arm32SshHelp
11+
12+
if "%arm32_ssh%"=="true" goto :Arm32Ssh
13+
14+
:Arm32Ssh
15+
if "%SSH_SERVER%"=="" goto :Arm32SshHelp
16+
if "%SSH%"=="" if EXIST %WINDIR%\System32\OpenSSH\ssh.exe (set SSH=%WINDIR%\System32\OpenSSH\ssh.exe)
17+
if "%SCP%"=="" if EXIST %WINDIR%\System32\OpenSSH\scp.exe (set SCP=%WINDIR%\System32\OpenSSH\scp.exe)
18+
echo SSH = %SSH%
19+
echo SCP = %SCP%
20+
if "%PYTHON_SOURCE%"=="" (set PYTHON_SOURCE=%here%..\..\)
21+
if "%REMOTE_PYTHON_DIR%"=="" (set REMOTE_PYTHON_DIR=C:\python\)
22+
if NOT "%REMOTE_PYTHON_DIR:~-1,1%"=="\" (set REMOTE_PYTHON_DIR=%REMOTE_PYTHON_DIR%\)
23+
%SSH% %SSH_SERVER% "if EXIST %REMOTE_PYTHON_DIR% (rd %REMOTE_PYTHON_DIR% /s/q)"
24+
%SSH% %SSH_SERVER% "md %REMOTE_PYTHON_DIR%PCBuild\arm32"
25+
%SSH% %SSH_SERVER% "md %REMOTE_PYTHON_DIR%temp"
26+
%SSH% %SSH_SERVER% "md %REMOTE_PYTHON_DIR%Modules"
27+
%SSH% %SSH_SERVER% "md %REMOTE_PYTHON_DIR%PC"
28+
for /f "USEBACKQ" %%i in (`dir PCbuild\*.bat /b`) do @%SCP% PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild"
29+
for /f "USEBACKQ" %%i in (`dir PCbuild\*.py /b`) do @%SCP% PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild"
30+
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.exe /b`) do @%SCP% PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
31+
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.pyd /b`) do @%SCP% PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
32+
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.dll /b`) do @%SCP% PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
33+
%SCP% -r "%PYTHON_SOURCE%Include" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Include"
34+
%SCP% -r "%PYTHON_SOURCE%Lib" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Lib"
35+
%SCP% -r "%PYTHON_SOURCE%Tools" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Tools"
36+
%SCP% "%PYTHON_SOURCE%Modules\Setup" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Modules"
37+
%SCP% "%PYTHON_SOURCE%PC\pyconfig.h" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PC"
38+
39+
exit /b %ERRORLEVEL%
40+
41+
:Arm32SshHelp
42+
echo SSH_SERVER environment variable must be set to administrator@[ip address]
43+
echo where [ip address] is the address of a Windows IoT Core ARM32 device.
44+
echo.
45+
echo The test worker should have the SSH agent running.
46+
echo Also a key must be created with ssh-keygen and added to both the buildbot worker machine
47+
echo and the ARM32 worker device: see https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh
48+
exit /b 127

Tools/buildbot/remotePythonInfo.bat

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@echo off
2+
rem Used by the buildbot "remotedeploy" step.
3+
setlocal
4+
5+
set here=%~dp0
6+
set arm32_ssh=
7+
set suffix=_d
8+
if "%REMOTE_PYTHON_DIR%"=="" (set REMOTE_PYTHON_DIR=C:\python\)
9+
if NOT "%REMOTE_PYTHON_DIR:~-1,1%"=="\" (set REMOTE_PYTHON_DIR=%REMOTE_PYTHON_DIR%\)
10+
11+
:CheckOpts
12+
if "%1"=="-arm32" (set arm32_ssh=true) & (set prefix=%REMOTE_PYTHON_DIR%pcbuild\arm32) & shift & goto CheckOpts
13+
if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts
14+
if "%1"=="+d" (set suffix=) & shift & goto CheckOpts
15+
if NOT "%1"=="" (echo unrecognized option %1) & goto Arm32SshHelp
16+
17+
if "%arm32_ssh%"=="true" goto :Arm32Ssh
18+
19+
:Arm32Ssh
20+
if "%SSH_SERVER%"=="" goto :Arm32SshHelp
21+
if "%SSH%"=="" if EXIST %WINDIR%\System32\OpenSSH\ssh.exe (set SSH=%WINDIR%\System32\OpenSSH\ssh.exe)
22+
set PYTHON_EXE=%prefix%\python%suffix%.exe
23+
echo on
24+
%SSH% %SSH_SERVER% %PYTHON_EXE% -m test.pythoninfo
25+
exit /b %ERRORLEVEL%
26+
27+
:Arm32SshHelp
28+
echo SSH_SERVER environment variable must be set to administrator@[ip address]
29+
echo where [ip address] is the address of a Windows IoT Core ARM32 device.
30+
echo.
31+
echo The test worker should have the SSH agent running.
32+
echo Also a key must be created with ssh-keygen and added to both the buildbot worker machine
33+
echo and the ARM32 worker device: see https://docs.microsoft.com/en-us/windows/iot-core/connect-your-device/ssh
34+
exit /b 127

Tools/buildbot/test.bat

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ if "%1"=="+d" (set rt_opts=%rt_opts:-d=%) & shift & goto CheckOpts
1818
if "%1"=="+q" (set rt_opts=%rt_opts:-q=%) & shift & goto CheckOpts
1919
if NOT "%1"=="" (set regrtest_args=%regrtest_args% %1) & shift & goto CheckOpts
2020

21+
if "%PROCESSOR_ARCHITECTURE%"=="ARM" if "%arm32_ssh%"=="true" goto NativeExecution
2122
if "%arm32_ssh%"=="true" goto :Arm32Ssh
2223

24+
:NativeExecution
2325
call "%here%..\..\PCbuild\rt.bat" %rt_opts% -uall -rwW --slowest --timeout=1200 --fail-env-changed %regrtest_args%
2426
exit /b %ERRORLEVEL%
2527

@@ -28,20 +30,12 @@ set dashU=-unetwork,decimal,subprocess,urlfetch,tzdata
2830
if "%SSH_SERVER%"=="" goto :Arm32SshHelp
2931
if "%PYTHON_SOURCE%"=="" (set PYTHON_SOURCE=%here%..\..\)
3032
if "%REMOTE_PYTHON_DIR%"=="" (set REMOTE_PYTHON_DIR=C:\python\)
33+
if NOT "%REMOTE_PYTHON_DIR:~-1,1%"=="\" (set REMOTE_PYTHON_DIR=%REMOTE_PYTHON_DIR%\)
34+
if "%SSH%"=="" if EXIST %WINDIR%\System32\OpenSSH\ssh.exe (set SSH=%WINDIR%\System32\OpenSSH\ssh.exe)
3135
set TEMP_ARGS=--temp %REMOTE_PYTHON_DIR%temp
32-
ssh %SSH_SERVER% "if EXIST %REMOTE_PYTHON_DIR% (rd %REMOTE_PYTHON_DIR% /s/q)"
33-
ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%PCBuild\arm32"
34-
ssh %SSH_SERVER% "md %REMOTE_PYTHON_DIR%temp"
35-
for /f "USEBACKQ" %%i in (`dir PCbuild\*.bat /b`) do @scp PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild"
36-
for /f "USEBACKQ" %%i in (`dir PCbuild\*.py /b`) do @scp PCBuild\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild"
37-
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.exe /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
38-
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.pyd /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
39-
for /f "USEBACKQ" %%i in (`dir PCbuild\arm32\*.dll /b`) do @scp PCBuild\arm32\%%i "%SSH_SERVER%:%REMOTE_PYTHON_DIR%PCBuild\arm32"
40-
scp -r "%PYTHON_SOURCE%Include" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Include"
41-
scp -r "%PYTHON_SOURCE%Lib" "%SSH_SERVER%:%REMOTE_PYTHON_DIR%Lib"
4236

4337
set rt_args=%rt_opts% %dashU% -rwW --slowest --timeout=1200 --fail-env-changed %regrtest_args% %TEMP_ARGS%
44-
ssh %SSH_SERVER% "set TEMP=%REMOTE_PYTHON_DIR%temp& %REMOTE_PYTHON_DIR%PCbuild\rt.bat" %rt_args%
38+
%SSH% %SSH_SERVER% "set TEMP=%REMOTE_PYTHON_DIR%temp& %REMOTE_PYTHON_DIR%PCbuild\rt.bat" %rt_args%
4539
exit /b %ERRORLEVEL%
4640

4741
:Arm32SshHelp

0 commit comments

Comments
 (0)