Run tests on buildbot.
Also fix a couple of failing tests.
BUG=
Review URL: https://codereview.chromium.org/11088016
git-svn-id: https://nativeclient-sdk.googlecode.com/svn/trunk/src@1432 050acbb0-2703-11df-ab0a-9f3f633ae91d
diff --git a/InstallerResources/install.bat b/InstallerResources/install.bat
index d15ed69..79f9c1b 100644
--- a/InstallerResources/install.bat
+++ b/InstallerResources/install.bat
@@ -1,3 +1,3 @@
@echo off
python.exe "%~dp0install.py" %*
-pause
\ No newline at end of file
+if not defined NO_PAUSE pause
diff --git a/InstallerResources/install.py b/InstallerResources/install.py
index c29a57d..d5f9319 100644
--- a/InstallerResources/install.py
+++ b/InstallerResources/install.py
@@ -39,16 +39,12 @@
if os.path.exists(directory):
shutil.rmtree(directory)
print 'Removed: %s' % (directory)
- else:
- print 'Failed to remove non-existant directory: %s' % (directory)
def UninstallFile(file_path):
if os.path.exists(file_path):
os.remove(file_path)
print 'Removed: %s' % (file_path)
- else:
- print 'Failed to remove non-existant file: %s' % (file_path)
def Uninstall(nacl_directory, pepper_directory, addin_directory):
@@ -126,11 +122,6 @@
print "\n\nWARNING: Only python version 2.6.2 or greater is supported. " \
"Current version is %s\n\n" % (sys.version_info[:3],)
- # Admin is needed to write to the default platform directory.
- if ctypes.windll.shell32.IsUserAnAdmin() != 1:
- raise InstallError("Not running as administrator. The install script needs "
- "write access to protected Visual Studio directories.")
-
# Ensure install directories exist.
if not os.path.exists(options.vsuser_path):
raise InstallError("Could not find user Visual Studio directory: %s" % (
@@ -140,10 +131,23 @@
options.msbuild_path))
addin_directory = os.path.join(options.vsuser_path, 'Addins')
- platform_directory = os.path.join(
- options.msbuild_path, 'Microsoft.Cpp\\v4.0\\Platforms')
- nacl_directory = os.path.join(platform_directory, NACL_PLATFORM_NAME)
- pepper_directory = os.path.join(platform_directory, PEPPER_PLATFORM_NAME)
+ platform_root = os.path.join(options.msbuild_path,
+ 'Microsoft.Cpp', 'v4.0', 'Platforms')
+ if not os.path.exists(platform_root):
+ raise InstallError("Could not find path: %s" % platform_root)
+
+ if (not os.access(addin_directory, os.W_OK)
+ or not os.access(platform_root, os.W_OK)):
+ # Admin is needed to write to the default platform directory.
+ if ctypes.windll.shell32.IsUserAnAdmin() != 1:
+ raise InstallError("Not running as administrator. The install script "
+ "needs write access to protected Visual Studio "
+ "directories.")
+ raise InstallError("install script needs write access to: %s"
+ % platform_root)
+
+ nacl_directory = os.path.join(platform_root, NACL_PLATFORM_NAME)
+ pepper_directory = os.path.join(platform_root, PEPPER_PLATFORM_NAME)
# If uninstalling then redirect to uninstall program.
if options.uninstall:
@@ -151,8 +155,8 @@
print "\nUninstall complete!\n"
sys.exit(0)
- if not os.path.exists(platform_directory):
- raise InstallError("Could not find path: %s" % platform_directory)
+ if not os.path.exists(platform_root):
+ raise InstallError("Could not find path: %s" % platform_root)
if not os.path.exists(addin_directory):
os.mkdir(addin_directory)
@@ -226,4 +230,3 @@
print "processes are closed."
else:
raise
-
diff --git a/UnitTests/ProjectSettingsTest.cs b/UnitTests/ProjectSettingsTest.cs
index 5c97275..3bc43b6 100644
--- a/UnitTests/ProjectSettingsTest.cs
+++ b/UnitTests/ProjectSettingsTest.cs
@@ -384,7 +384,7 @@
AllConfigsAssertPropertyEquals(page, "ExceptionHandling", "true", false);
// C/C++ Output Files
- AllConfigsAssertPropertyEquals(page, "ObjectFileName", @"$(IntDir)%(FileName).o", false);
+ AllConfigsAssertPropertyEquals(page, "ObjectFileName", @"$(IntDir)", false);
// C/C++ Advanced
AllConfigsAssertPropertyEquals(page, "CompileAs", "Default", true);
diff --git a/UnitTests/PropertyManagerTest.cs b/UnitTests/PropertyManagerTest.cs
index 4c701ad..f841d61 100644
--- a/UnitTests/PropertyManagerTest.cs
+++ b/UnitTests/PropertyManagerTest.cs
@@ -100,6 +100,7 @@
string expectedSDKRootDir =
Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable);
Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not set!");
+ expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' });
PropertyManager target = new PropertyManager();
dte_.Solution.Open(naclSolution);
@@ -176,6 +177,7 @@
string expectedSDKRootDir =
Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable);
Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not set!");
+ expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' });
// Set up the property manager to read the NaCl platform settings from BlankValidSolution.
PropertyManager target = new PropertyManager();
diff --git a/build.bat b/build.bat
index 633e94b..3a2f211 100644
--- a/build.bat
+++ b/build.bat
@@ -1,6 +1,9 @@
@echo off
+setlocal
:: Set up the Visual Studio environment
call "%VS100COMNTOOLS%vsvars32.bat"
msbuild "%~dp0NativeClientVSAddIn.sln"
-python "%~dp0create_package.py"
\ No newline at end of file
+python "%~dp0create_package.py"
+
+endlocal
diff --git a/buildbot_run.py b/buildbot_run.py
index d6b2020..6876c01 100644
--- a/buildbot_run.py
+++ b/buildbot_run.py
@@ -11,19 +11,32 @@
import os
import sys
import subprocess
+import urllib2
+import zipfile
GSURL = 'https://commondatastorage.googleapis.com'
GSPATH = 'nativeclient-mirror/nacl/nacl_sdk/sdk'
+SDKROOT = os.path.join('..', '..', 'out', 'sdk')
+
def Log(msg):
sys.stdout.write(msg + '\n')
sys.stdout.flush()
-def RunCommand(cmd):
+def RunCommand(cmd, env=None):
Log("Running: %s" % cmd)
Log("CWD: %s" % os.getcwd())
- rtn = subprocess.call(cmd, shell=True)
+ if type(cmd) == str:
+ cmd = cmd.split()
+
+ if sys.platform == 'cygwin':
+ # allow bat files in the current working directory to
+ # be executed on cygwin as they are on win32
+ if not os.path.dirname(cmd[0]) and os.path.exists(cmd[0]):
+ cmd = './' + cmd
+
+ rtn = subprocess.call(cmd, shell=True, env=env)
if rtn:
Log('@@@STEP_FAILURE@@@')
sys.exit(1)
@@ -31,16 +44,41 @@
def StepBuild():
Log('@@@BUILD_STEP build AddIn@@@')
- if sys.platform == 'cygwin':
- RunCommand(['./build.bat'])
- else:
- RunCommand(['build.bat'])
+ RunCommand('build.bat')
+
+
+def StepInstall():
+ Log('@@@BUILD_STEP Install AddIn@@@')
+ RunCommand('developer_deploy.bat')
+
+
+def StepInstallSDK():
+ Log('@@@BUILD_STEP Install SDK@@@')
+ naclsdk = os.path.join(SDKROOT, 'nacl_sdk', 'naclsdk.bat')
+ if not os.path.exists(naclsdk):
+ if not os.path.exists(SDKROOT):
+ os.makedirs(SDKROOT)
+ filename = os.path.join(SDKROOT, 'nacl_sdk.zip')
+ url = GSURL + "/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip"
+ contents = urllib2.urlopen(url).read()
+ with open(filename, 'wb') as zfileout:
+ zfileout.write(contents)
+ zfile = zipfile.ZipFile(filename)
+ zfile.extractall(SDKROOT)
+
+ RunCommand([naclsdk, 'update', '--force', 'pepper_23'])
+ RunCommand([naclsdk, 'update', '--force', 'pepper_canary'])
def StepTest():
Log('@@@BUILD_STEP Testing AddIn@@@')
# Don't actually test yet
- #RunCommand(['test.bat'])
+ env = dict(os.environ)
+ sdkroot = os.path.abspath(os.path.join(SDKROOT, 'nacl_sdk'))
+ env['NACL_SDK_ROOT'] = os.path.join(sdkroot, 'pepper_23')
+ RunCommand('test.bat', env)
+ env['NACL_SDK_ROOT'] = os.path.join(sdkroot, 'pepper_canary')
+ RunCommand('test.bat', env)
def _FindInPath(filename):
@@ -94,6 +132,8 @@
def main():
StepBuild()
+ StepInstall()
+ StepInstallSDK()
StepTest()
StepArchive()
diff --git a/developer_deploy.bat b/developer_deploy.bat
index e7085df..dc6bf3d 100644
--- a/developer_deploy.bat
+++ b/developer_deploy.bat
@@ -9,12 +9,10 @@
rmdir /s /q "%OUT_DIR%\%ZIP_BASE%"
)
-call "%~dp0build.bat"
-
python.exe -c "import tarfile; zztop=tarfile.open(r'%OUT_DIR%\%ZIP_BASE%.tgz'); zztop.extractall(r'%OUT_DIR%'); zztop.close()"
:: Pass flags to bypass the install questions. Also pipe a key stroke 'return' to pass the 'Press any key to continue' in install.bat
-echo. | call "%OUT_DIR%\%ZIP_BASE%\install.bat" --force --ppapi
+set NO_PAUSE=1
+call "%OUT_DIR%\%ZIP_BASE%\install.bat" --force --ppapi
endlocal
-pause