Skip to content

Commit

Permalink
Merge b1d21ec into 3bb31f0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoody256 committed Dec 28, 2017
2 parents 3bb31f0 + b1d21ec commit 33d04ec
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 70 deletions.
76 changes: 76 additions & 0 deletions .appveyor.yml
@@ -0,0 +1,76 @@
image: Visual Studio 2017
shallow_clone: true

install:

#set python version, and cygwin tools for clang tests
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;C:\\cygwin64\\bin;C:\\msys64;%PATH%"
- python --version
- pip install lxml
- pip install pypiwin32
- choco install dmd
- choco install ldc
- choco install swig
- choco install vswhere

environment:
matrix:
- PYTHON: "C:\\Python27"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python27"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python27"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python27"
BUILD_JOB_NUM: 4

- PYTHON: "C:\\Python35"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python35"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python35"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python35"
BUILD_JOB_NUM: 4

- PYTHON: "C:\\Python36"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python36"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python36"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python36"
BUILD_JOB_NUM: 4

- PYTHON: "C:\\Python27-x64"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python27-x64"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python27-x64"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python27-x64"
BUILD_JOB_NUM: 4

- PYTHON: "C:\\Python35-x64"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python35-x64"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python35-x64"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python35-x64"
BUILD_JOB_NUM: 4

- PYTHON: "C:\\Python36-x64"
BUILD_JOB_NUM: 1
- PYTHON: "C:\\Python36-x64"
BUILD_JOB_NUM: 2
- PYTHON: "C:\\Python36-x64"
BUILD_JOB_NUM: 3
- PYTHON: "C:\\Python36-x64"
BUILD_JOB_NUM: 4

build: off
build_script:
- cmd: echo src\engine\SCons\JobTests.py > exclude_jobs.txt
- cmd: python runtest.py -l -a --exclude-list exclude_jobs.txt > all_tests.txt
- cmd: powershell "./.appveyor/runtest.ps1"
46 changes: 46 additions & 0 deletions .appveyor/runtest.ps1
@@ -0,0 +1,46 @@

function Retry-Command
{
param (
[Parameter(Mandatory=$true)][string]$command,
[Parameter(Mandatory=$false)][hashtable]$args,
[Parameter(Mandatory=$false)][int]$retries = 5,
[Parameter(Mandatory=$false)][int]$secondsDelay = 2
)

# Setting ErrorAction to Stop is important. This ensures any errors that occur in the command are
# treated as terminating errors, and will be caught by the catch block.
# $command.ErrorAction = "Stop"

$retrycount = 0
$completed = $false

while (-not $completed) {
try {
Invoke-Expression $command
Write-Verbose ("Command [{0}] succeeded." -f $command)
$completed = $true
} catch {
if ($retrycount -ge $retries) {
Write-Verbose ("Command [{0}] failed the maximum number of {1} times." -f $command, $retrycount)
throw
} else {
Write-Verbose ("Command [{0}] failed. Retrying in {1} seconds." -f $command, $secondsDelay)
Start-Sleep $secondsDelay
$retrycount++
}
}
}
}

Retry-Command -Command "python runtest.py src/engine/SCons/JobTests.py" -Verbose

$TOTAL_BUILD_JOBS = 4;
$Lines = (Get-Content all_tests.txt | Measure-Object -line).Lines;
$start = ($Lines / $TOTAL_BUILD_JOBS) * ($Env:BUILD_JOB_NUM - 1);
$end = ($Lines / $TOTAL_BUILD_JOBS) * $Env:BUILD_JOB_NUM;
if ( $Env:BUILD_JOB_NUM -eq $TOTAL_BUILD_JOBS){ $end = $Lines };
if ( $start -eq 0 ){ $start = 1 };
get-content all_tests.txt | select -first ($end - $start) -skip ($start - 1) | Out-File -Encoding ASCII build_tests.txt;
python runtest.py -j 2 -f build_tests.txt;
if($LastExitCode -eq 2 -Or $LastExitCode -eq 0) { $host.SetShouldExit(0 )} else {$host.SetShouldExit(1)}
4 changes: 4 additions & 0 deletions README.rst
Expand Up @@ -16,6 +16,10 @@ SCons - a software construction tool
.. image:: https://travis-ci.org/SCons/scons.svg?branch=master
:target: https://travis-ci.org/SCons/scons
:alt: Travis CI build status

.. image:: https://ci.appveyor.com/api/projects/status/github/SCons/scons?svg=true&branch=master
:target: https://ci.appveyor.com/project/SCons/scons
:alt: AppVeyor CI Status

.. image:: https://coveralls.io/repos/github/SCons/scons/badge.svg
:target: https://coveralls.io/github/SCons/scons
Expand Down
21 changes: 6 additions & 15 deletions runtest.py
Expand Up @@ -92,17 +92,11 @@
import sys
import time

try:
import threading
try: # python3
from queue import Queue
except ImportError as e: # python2
from Queue import Queue
threading_ok = True
except ImportError:
print("Can't import threading or queue")
threading_ok = False

import threading
try: # python3
from queue import Queue
except ImportError as e: # python2
from Queue import Queue
import subprocess


Expand Down Expand Up @@ -864,7 +858,7 @@ def run(self):
run_test(t, io_lock, True)
self.queue.task_done()

if jobs > 1 and threading_ok:
if jobs > 1:
print("Running tests using %d jobs"%jobs)
# Start worker threads
queue = Queue()
Expand All @@ -878,9 +872,6 @@ def run(self):
queue.put(t)
queue.join()
else:
# Run tests serially
if jobs > 1:
print("Ignoring -j%d option; no python threading module available."%jobs)
for t in tests:
run_test(t, None, False)

Expand Down
4 changes: 4 additions & 0 deletions test/CPPDEFINES/pkg-config.py
Expand Up @@ -29,12 +29,16 @@
"""

import TestSCons
from SCons.Environment import Base

test = TestSCons.TestSCons()

pkg_config_path = test.where_is('pkg-config')
if not pkg_config_path:
test.skip_test("Could not find 'pkg-config' in system PATH, skipping test.\n")

if Base()['PLATFORM'] == 'win32':
test.skip_test("pkg-config test not setup for windows, skipping test.\n")

test.write('bug.pc', """\
prefix=/usr
Expand Down
7 changes: 6 additions & 1 deletion test/Clang/clang_default_environment.py
Expand Up @@ -25,13 +25,18 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
test.skip_test("Could not find 'clang', skipping test.\n")

platform = Base()['PLATFORM']
if 'win32' == platform:
test.skip_test("clang is not part of default environment on windows, skipping test.\n")

## This will likely NOT use clang

test.write('SConstruct', """
Expand Down Expand Up @@ -61,4 +66,4 @@
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
# vim: set expandtab tabstop=4 shiftwidth=4:
13 changes: 9 additions & 4 deletions test/Clang/clang_shared_library.py
Expand Up @@ -33,6 +33,8 @@
if not test.where_is('clang'):
test.skip_test("Could not find 'clang', skipping test.\n")

env_str = "env = Environment(tools=['clang', 'link'])"

platform = Base()['PLATFORM']
if platform == 'posix':
filename = 'foo.os'
Expand All @@ -41,15 +43,18 @@
filename = 'foo.os'
libraryname = 'libfoo.dylib'
elif platform == 'win32':
filename = 'foo.obj'
filename = 'foo.os'
libraryname = 'foo.dll'
# add the environment, otherwise the environment will consist of only vcvarsall.bat variables
# and not clang
env_str = "import os\nenv = Environment(tools=['clang', 'link'], ENV = os.environ)"
else:
test.fail_test()

test.write('SConstruct', """\
env = Environment(tools=['clang', 'link'])
%s
env.SharedLibrary('foo', 'foo.c')
""")
""" % env_str)

test.write('foo.c', """\
int bar() {
Expand All @@ -68,4 +73,4 @@
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
# vim: set expandtab tabstop=4 shiftwidth=4:
14 changes: 11 additions & 3 deletions test/Clang/clang_specific_environment.py
Expand Up @@ -25,17 +25,25 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
test.skip_test("Could not find 'clang', skipping test.\n")

env_str = "env = Environment(tools=['clang', 'link'])"
platform = Base()['PLATFORM']
if platform == 'win32':
# add the environment, otherwise the environment will consist of only vcvarsall.bat variables
# and not clang
env_str = "import os\nenv = Environment(tools=['clang', 'link'], ENV = os.environ)"

test.write('SConstruct', """\
env = Environment(tools=['clang', 'link'])
%s
env.Program('foo.c')
""")
""" % env_str)

test.write('foo.c', """\
#include <stdio.h>
Expand All @@ -57,4 +65,4 @@
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
# vim: set expandtab tabstop=4 shiftwidth=4:
15 changes: 12 additions & 3 deletions test/Clang/clang_static_library.py
Expand Up @@ -25,17 +25,26 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
test.skip_test("Could not find 'clang', skipping test.\n")

env_str = "env = Environment(tools=['clang', 'ar'])"
platform = Base()['PLATFORM']
if platform == 'win32':
# add the environment, otherwise the environment will consist of only vcvarsall.bat variables
# and not clang
env_str = "import os\nenv = Environment(tools=['clang', 'ar'], ENV = os.environ)"


test.write('SConstruct', """\
env = Environment(tools=['clang', 'ar'])
%s
env.StaticLibrary('foo', 'foo.c')
""")
""" % env_str)

test.write('foo.c', """\
int bar() {
Expand All @@ -53,4 +62,4 @@
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
# vim: set expandtab tabstop=4 shiftwidth=4:
10 changes: 8 additions & 2 deletions test/Clang/clangxx_default_environment.py
Expand Up @@ -25,13 +25,19 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
from SCons.Environment import Base

_exe = TestSCons._exe
test = TestSCons.TestSCons()

if not test.where_is('clang'):
if not test.where_is('clang++'):
test.skip_test("Could not find 'clang++', skipping test.\n")

platform = Base()['PLATFORM']
if 'win32' == platform:
test.skip_test("clang++ is not part of default environment on windows, skipping test.\n")


## This will likely NOT use clang++.

test.write('SConstruct', """\
Expand Down Expand Up @@ -61,4 +67,4 @@
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
# vim: set expandtab tabstop=4 shiftwidth=4:

0 comments on commit 33d04ec

Please sign in to comment.