aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Fugate <dfugate@microsoft.com>2011-09-26 16:12:46 -0700
committerDavid Fugate <dfugate@microsoft.com>2011-09-26 16:12:46 -0700
commitffa85c258404e9808aa1595c1268593960f279d9 (patch)
tree68ad6c27f141bd34694b66cd4e2f5bc36bc400eb /tools
parent352d86b8edf3d6efe1eac0c08df26fabf260682f (diff)
Moved all test helper functions into sta.js; removed sputnikLib.js.
Laid down the groundwork for a console-based test runner.
Diffstat (limited to 'tools')
-rw-r--r--tools/packaging/packager.py53
-rw-r--r--tools/packaging/packagerConfig.py3
-rw-r--r--tools/packaging/templates/runner.test262.html1
3 files changed, 43 insertions, 14 deletions
diff --git a/tools/packaging/packager.py b/tools/packaging/packager.py
index a7c11e1a9..847995187 100644
--- a/tools/packaging/packager.py
+++ b/tools/packaging/packager.py
@@ -47,6 +47,8 @@ __parser.add_argument('version', action='store',
help='Version of the test suite.')
__parser.add_argument('--type', action='store', default='test262',
help='Type of test case runner to generate.')
+__parser.add_argument('--console', action='store_true', default=False,
+ help='Type of test case runner to generate.')
ARGS = __parser.parse_args()
if not os.path.exists(EXCLUDED_FILENAME):
@@ -92,6 +94,21 @@ if not hasattr(ARGS, "version"):
sys.exit(1)
#--Helpers--------------------------------------------------------------------#
+def createDepDirs(dirName):
+ #base case
+ if dirName==os.path.dirname(dirName):
+ if not os.path.exists(dirName):
+ os.mkdir(dirName)
+ else:
+ if not os.path.exists(dirName):
+ createDepDirs(os.path.dirname(dirName))
+ os.mkdir(dirName)
+
+def test262PathToConsoleFile(path):
+ stuff = os.path.join(TEST262_CONSOLE_CASES_DIR, path.replace("/", os.path.sep))
+ createDepDirs(os.path.dirname(stuff))
+ return stuff
+
def getJSCount(dirName):
'''
Returns the total number of *.js files (recursively) under a given
@@ -210,9 +227,7 @@ for chapter in TEST_SUITE_SECTIONS:
if EXCLUDE_LIST.count(testName)==0:
# dictionary for each test
testDict = {}
- #TODO
- #testDict["id"] = testName
- testDict["path"] = testPath.replace("/ietestcenter", "").replace("/sputnik_converted", "")
+ testDict["path"] = testPath
tempFile = open(test, "r")
scriptCode = tempFile.readlines()
@@ -233,10 +248,10 @@ for chapter in TEST_SUITE_SECTIONS:
if scriptCodeContent=="":
print "WARNING (" + test + "): unable to strip comments/license header/etc."
scriptCodeContent = "".join(scriptCode)
- scriptCodeContent = base64.b64encode(scriptCodeContent)
+ scriptCodeContentB64 = base64.b64encode(scriptCodeContent)
#add the test encoded code node to our test dictionary
- testDict["code"] = scriptCodeContent
+ testDict["code"] = scriptCodeContentB64
#now close the dictionary for the test
#now get the metadata added.
@@ -248,6 +263,12 @@ for chapter in TEST_SUITE_SECTIONS:
#this adds the test to our tests array
tests.append(testDict)
+
+ if ARGS.console:
+ with open(test262PathToConsoleFile(testDict["path"]), "w") as fConsole:
+ fConsole.write(scriptCodeContent)
+ with open(test262PathToConsoleFile(testDict["path"][:-3] + "_metadata.js"), "w") as fConsoleMeta:
+ fConsoleMeta.write("testDescrip = " + str(testDict))
testCount += 1
else:
print "Excluded:", testName
@@ -295,13 +316,19 @@ print ""
print "Deploying test harness files to 'TEST262_WEB_HARNESS_DIR'..."
if TEST262_HARNESS_DIR!=TEST262_WEB_HARNESS_DIR:
for filename in [x for x in os.listdir(TEST262_HARNESS_DIR) if x.endswith(".js")]:
- toFilename = os.path.join(TEST262_WEB_HARNESS_DIR, filename)
- fileExists = os.path.exists(toFilename)
- if fileExists:
- SC_HELPER.edit(toFilename)
- shutil.copy(os.path.join(TEST262_HARNESS_DIR, filename),
- toFilename)
- if not fileExists:
- SC_HELPER.add(toFilename)
+ toFilenameList = [ os.path.join(TEST262_WEB_HARNESS_DIR, filename)]
+ if ARGS.console:
+ toFilenameList.append(os.path.join(TEST262_CONSOLE_HARNESS_DIR, filename))
+
+ for toFilename in toFilenameList:
+ if not os.path.exists(os.path.dirname(toFilename)):
+ os.mkdir(os.path.dirname(toFilename))
+ fileExists = os.path.exists(toFilename)
+ if fileExists:
+ SC_HELPER.edit(toFilename)
+ shutil.copy(os.path.join(TEST262_HARNESS_DIR, filename),
+ toFilename)
+ if not fileExists:
+ SC_HELPER.add(toFilename)
print "Done."
diff --git a/tools/packaging/packagerConfig.py b/tools/packaging/packagerConfig.py
index f13d8f42b..1d0af2b9f 100644
--- a/tools/packaging/packagerConfig.py
+++ b/tools/packaging/packagerConfig.py
@@ -28,6 +28,7 @@ import re
MAX_CASES_PER_JSON = 1000
WEBSITE_SHORT_NAME = "website"
+CONSOLE_SHORT_NAME = "console"
#Path to the root of the Hg repository (relative to this file's location)
TEST262_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..")
@@ -42,9 +43,11 @@ TEST262_HARNESS_DIR = os.path.join(TEST262_ROOT, "test", "harness")
#Directory full of website test cases (ported over from TEST262_CASES_DIR)
TEST262_WEB_CASES_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME, "json")
+TEST262_CONSOLE_CASES_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME)
#Directory containing the website's test harness (ported over from TEST262_HARNESS_DIR)
TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME, "harness")
+TEST262_CONSOLE_HARNESS_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME, "harness")
#Path to the ported test case files on the actual website as opposed to the Hg layout
WEBSITE_CASES_PATH = "json/"
diff --git a/tools/packaging/templates/runner.test262.html b/tools/packaging/templates/runner.test262.html
index 47331606f..1c17ca39c 100644
--- a/tools/packaging/templates/runner.test262.html
+++ b/tools/packaging/templates/runner.test262.html
@@ -13,7 +13,6 @@
<script type="text/javascript" src="harness/jqueryprogressbar.js"></script>
<script type="text/javascript" src="harness/helper.js"></script>
<script type="text/javascript" src="harness/jquery.base64.js"></script>
-<script type="text/javascript" src="harness/sputnikLib.js"></script>
<script language="javascript" type="text/javascript">
//To support all the browsers
$(window).resize(ResizeLoadIndicator);