From 5e0a22f4204b764663047b335076cbddda9f6062 Mon Sep 17 00:00:00 2001 From: David Fugate Date: Sun, 25 Sep 2011 11:47:50 -0700 Subject: Removed TestCaseHTMLPackager. Replacement is tools/packaging/*. --- tools/TestCaseHTMLPackager/TestCasePackager.py | 308 --------------------- .../TestCaseHTMLPackager/TestCasePackagerConfig.py | 110 -------- tools/TestCaseHTMLPackager/TestUpdater.ps1 | Bin 3428 -> 0 bytes .../templates/runner.test262.html | 170 ------------ 4 files changed, 588 deletions(-) delete mode 100644 tools/TestCaseHTMLPackager/TestCasePackager.py delete mode 100644 tools/TestCaseHTMLPackager/TestCasePackagerConfig.py delete mode 100644 tools/TestCaseHTMLPackager/TestUpdater.ps1 delete mode 100644 tools/TestCaseHTMLPackager/templates/runner.test262.html (limited to 'tools') diff --git a/tools/TestCaseHTMLPackager/TestCasePackager.py b/tools/TestCaseHTMLPackager/TestCasePackager.py deleted file mode 100644 index 7c7a02d14..000000000 --- a/tools/TestCaseHTMLPackager/TestCasePackager.py +++ /dev/null @@ -1,308 +0,0 @@ -# Copyright (c) 2009 Microsoft Corporation -# -# Redistribution and use in source and binary forms, with or without modification, are permitted provided -# that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this list of conditions and -# the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and -# the following disclaimer in the documentation and/or other materials provided with the distribution. -# * Neither the name of Microsoft nor the names of its contributors may be used to -# endorse or promote products derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#--Imports--------------------------------------------------------------------- -import argparse -import os -import sys -import xml.dom.minidom -import base64 -import datetime -import shutil -import re -import json -import stat - -#--Stubs----------------------------------------------------------------------- -def generateHarness(harnessType, jsonFile, description): - pass - - -#------------------------------------------------------------------------------ -from TestCasePackagerConfig import * - -#--Globals--------------------------------------------------------------------- - -__parser = argparse.ArgumentParser(description='Tool used to generate the test262 website') -__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.') -ARGS = __parser.parse_args() - -if not os.path.exists(EXCLUDED_FILENAME): - print "Cannot generate (JSON) test262 tests without a file, %s, showing which tests have been disabled!" % EXCLUDED_FILENAME - sys.exit(1) -EXCLUDE_LIST = xml.dom.minidom.parse(EXCLUDED_FILENAME) -EXCLUDE_LIST = EXCLUDE_LIST.getElementsByTagName("test") -EXCLUDE_LIST = [x.getAttribute("id") for x in EXCLUDE_LIST] - -#a list of all ES5 test chapter directories -TEST_SUITE_SECTIONS = [] - -#total number of tests accross the entire set of tests. -TOTAL_TEST_COUNT = 0 - -#global which states whether the test case we're currently processing is in -#the midst of a "/* ... */" style comment -IS_MULTILINE_COMMENT = False - -#List of all *.json files containing encoded test cases -SECTIONS_LIST = [] - -ONE_JSON_PER_CHAPTER = False -TESTCASELIST_PER_JSON = False - -#--Sanity checks--------------------------------------------------------------# -if not os.path.exists(TEST262_CASES_DIR): - print "Cannot generate (JSON) test262 tests when the path containing said tests, %s, does not exist!" % TEST262_CASES_DIR - sys.exit(1) - -if not os.path.exists(TEST262_HARNESS_DIR): - print "Cannot copy the test harness from a path, %s, that does not exist!" % TEST262_HARNESS_DIR - sys.exit(1) - -if not os.path.exists(TEST262_WEB_CASES_DIR): - os.mkdir(TEST262_WEB_CASES_DIR) - -if not os.path.exists(TEST262_WEB_HARNESS_DIR): - os.mkdir(TEST262_WEB_HARNESS_DIR) - -if not hasattr(ARGS, "version"): - print "A test262 suite version must be specified from the command-line to run this script!" - sys.exit(1) - -#--Helpers--------------------------------------------------------------------# -def getJSCount(dirName): - ''' - Returns the total number of *.js files (recursively) under a given - directory, dirName. - ''' - retVal = 0 - if os.path.isfile(dirName) and dirName.endswith(".js"): - retVal = 1 - elif os.path.isdir(dirName): - tempList = [os.path.join(dirName, x) for x in os.listdir(dirName)] - for x in tempList: - retVal += getJSCount(x) - #else: - # raise Exception("getJSCount: encountered a non-file/non-dir!") - return retVal - -#------------------------------------------------------------------------------ -def dirWalker(dirName): - ''' - Populates TEST_SUITE_SECTIONS with ES5 test directories based - upon the number of test files per directory. - ''' - global TEST_SUITE_SECTIONS - #First check to see if it has test files directly inside it - temp = [os.path.join(dirName, x) for x in os.listdir(dirName) if not os.path.isdir(os.path.join(dirName, x))] - if len(temp)!=0: - TEST_SUITE_SECTIONS.append(dirName) - return - - #Next check to see if all *.js files under this directory exceed our max - #for a JSON file - temp = getJSCount(dirName) - if temp==0: - print "ERROR: expected there to be JavaScript tests under dirName!" - sys.exit(1) - elif temp < MAX_CASES_PER_JSON: - TEST_SUITE_SECTIONS.append(dirName) - return - else: - #Max has been exceeded. We need to look at each subdir individually - temp = os.listdir(dirName) - for tempSubdir in temp: - dirWalker(os.path.join(dirName, tempSubdir)) - -#------------------------------------------------------------------------------ -def isTestStarted(line): - ''' - Used to detect if we've gone past extraneous test comments in a test case. - - Note this is a naive approach on the sense that "/*abc*/" could be on one - line. However, we know for a fact this is not the case in IE Test Center - or Sputnik tests. - ''' - global IS_MULTILINE_COMMENT - - if IS_MULTILINE_COMMENT and ("*/" in line): #End of a newline comment - IS_MULTILINE_COMMENT = False - return False - elif "/*" in line: #Beginning of a newline comment - IS_MULTILINE_COMMENT = True - return False - elif IS_MULTILINE_COMMENT: #//we're already in a multi-line comment that hasn't ended - return False - elif re.match("^\s*//", line)!=None: #//blah - return False - elif re.match("^\s*$", line)!=None: #newlines - return False - elif "ES5Harness" in line: #definitely start of the test! - return True - return True - -#------------------------------------------------------------------------------ -def getAllJSFiles(dirName): - retVal = [] - for fullPath,dontCare,files in os.walk(dirName): - retVal += [os.path.join(fullPath,b) for b in files if b.endswith(".js")] - return retVal - -#--MAIN------------------------------------------------------------------------ -for temp in TEST_CONTRIB_DIRS: - temp = os.path.join(TEST262_CASES_DIR, temp) - if not os.path.exists(temp): - print "The expected ES5 test directory,", temp, "did not exist!" - sys.exit(1) - - if not ONE_JSON_PER_CHAPTER: - dirWalker(temp) - else: - for tempSubdir in os.listdir(temp): - TEST_SUITE_SECTIONS.append(os.path.join(temp, tempSubdir)) - - -for chapter in TEST_SUITE_SECTIONS: - chapterName = chapter.rsplit(os.path.sep, 1)[1] - print "Generating test cases for ES5 chapter:", chapterName - #create dictionaries for all our tests and a section - testsList = {} - sect = {} - sect["name"] = "Chapter - " + chapterName - - #create an array for tests in a chapter - tests = [] - sourceFiles = getAllJSFiles(chapter) - - if len(sourceFiles)!=0: - excluded = 0 - testCount = 0 - for test in sourceFiles: - #TODO - use something other than the hard-coded 'TestCases' below - testPath = "TestCases" + test.split(TEST262_CASES_DIR, 1)[1].replace("\\", "/") - testName=test.rsplit(".", 1)[0] - testName=testName.rsplit(os.path.sep, 1)[1] - if EXCLUDE_LIST.count(testName)==0: - # dictionary for each test - testDict = {} - testDict["id"] = testName - testDict["path"] = testPath.replace("/ietestcenter", "").replace("/sputnik_converted", "") - - tempFile = open(test, "r") - scriptCode = tempFile.readlines() - tempFile.close() - scriptCodeContent="" - #Rip out license headers that add unnecessary bytes to the JSON'ized test cases - inBeginning = True - IS_MULTILINE_COMMENT = False - - for line in scriptCode: - if inBeginning: - isStarted = isTestStarted(line) - if not isStarted: - continue - inBeginning = False - scriptCodeContent += line - - if scriptCodeContent=="": - print "WARNING (" + test + "): unable to strip comments/license header/etc." - scriptCodeContent = "".join(scriptCode) - scriptCodeContent = base64.b64encode(scriptCodeContent) - - #add the test encoded code node to our test dictionary - testDict["code"] = scriptCodeContent - #now close the dictionary for the test - - #this adds the test to our tests array - tests.append(testDict) - testCount += 1 - else: - print "Excluded:", testName - excluded = excluded + 1 - - #we have completed our tests - # add section node, number of tests and the tests themselves. - sect["numTests"] = str(len(sourceFiles)-excluded) - sect["tests"] = tests - - #create a node for the tests and add it to our testsLists - testsList["testsCollection"] = sect - with open(os.path.join(TEST262_WEB_CASES_DIR, chapterName + ".json"), "w") as f: - json.dump(testsList, f, separators=(',',':'), sort_keys=True) - - - if TESTCASELIST_PER_JSON: - CHAPTER_TEST_CASES_JSON = {} - CHAPTER_TEST_CASES_JSON["numTests"] = int(sect["numTests"]) - CHAPTER_TEST_CASES_JSON["version"] = ARGS.version - CHAPTER_TEST_CASES_JSON["date"] = str(datetime.datetime.now().date()) - CHAPTER_TEST_CASES_JSON["testSuite"] = [WEBSITE_CASES_PATH + chapterName + ".json"] - with open(os.path.join(TEST262_WEB_CASES_DIR, "testcases_%s.json" % chapterName), "w") as f: - json.dump(CHAPTER_TEST_CASES_JSON, f, separators=(',',':'), sort_keys=True) - generateHarness(ARGS.type, "testcases_%s.json" % chapterName, chapterName.replace("chapter", "Chapter ")) - - #add the name of the chapter test to our complete list - SECTIONS_LIST.append(WEBSITE_CASES_PATH + chapterName + ".json") - TOTAL_TEST_COUNT += int(sect["numTests"]) - - -#we now have the list of files for each chapter -#create a root node for our suite -TEST_CASES_JSON = {} -TEST_CASES_JSON["numTests"] = TOTAL_TEST_COUNT -TEST_CASES_JSON["version"] = ARGS.version -TEST_CASES_JSON["date"] = str(datetime.datetime.now().date()) -TEST_CASES_JSON["testSuite"] = SECTIONS_LIST -with open(os.path.join(TEST262_WEB_CASES_DIR, "default.json"), "w") as f: - json.dump(TEST_CASES_JSON, f, separators=(',',':'), sort_keys=True) -generateHarness(ARGS.type, "default.json", "Chapters 1-16") - -#Deploy test harness to website as well -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) - -#Copying the global scope files over as well -#TODO: really the HTML harness file should be generated as well... -print "" -print "Deploying global scope metadata files to 'TEST262_WEB_HARNESS_DIR'..." -for gsf in GLOBAL_SCOPE_FILES: - toFilename = os.path.join(TEST262_WEB_CASES_DIR, gsf) - fileExists = os.path.exists(toFilename) - if fileExists: - SC_HELPER.edit(toFilename) - shutil.copy(os.path.join(TEST262_CASES_DIR, gsf), - toFilename) - if not fileExists: - SC_HELPER.add(toFilename) - -print "Done." diff --git a/tools/TestCaseHTMLPackager/TestCasePackagerConfig.py b/tools/TestCaseHTMLPackager/TestCasePackagerConfig.py deleted file mode 100644 index 9364556d7..000000000 --- a/tools/TestCaseHTMLPackager/TestCasePackagerConfig.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (c) 2009 Microsoft Corporation -# -# Redistribution and use in source and binary forms, with or without modification, are permitted provided -# that the following conditions are met: -# * Redistributions of source code must retain the above copyright notice, this list of conditions and -# the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and -# the following disclaimer in the documentation and/or other materials provided with the distribution. -# * Neither the name of Microsoft nor the names of its contributors may be used to -# endorse or promote products derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#--Imports--------------------------------------------------------------------- -import os -import subprocess -import stat - -#--Globals--------------------------------------------------------------------- -MAX_CASES_PER_JSON = 1000 - -#Directories under "test\suite\" containing ES5 test chapter directories -#with *.js tests underneath them -TEST_CONTRIB_DIRS = ["sputnik_converted", "ietestcenter"] - -#Global scope source files found directly under "test\suite\". -GLOBAL_SCOPE_FILES = ["SputnikGlobalScope.js", "IETCGlobalScope.js"] - -#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__)), "..", "..") -TEST262_ROOT = os.path.abspath(TEST262_ROOT) - -#Directory full of test cases we want to port to the website's test harness runner -TEST262_CASES_DIR = os.path.join(TEST262_ROOT, "test", "suite") - -#Directory containing test harness files to be ported over to the website. Note that -#only *.js files will be migrated from this dir. -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", "resources", "scripts", "testcases") - -#Directory containing the website's test harness (ported over from TEST262_HARNESS_DIR) -TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, "website", "resources", "scripts", "global") - -#Path to the ported test case files on the actual website as opposed to the Hg layout -WEBSITE_CASES_PATH = "resources/scripts/testcases/" - -#The name of a file which contains a list of tests which should be disabled in test262. -#These tests are either invalid as-per ES5 or have issues with the test262 web harness. -EXCLUDED_FILENAME = os.path.join(TEST262_ROOT, "test", "config", "excludelist.xml") - -#------------------------------------------------------------------------------ - -TEMPLATE_LINES = None -__lastHarnessType = None - -def generateHarness(harnessType, jsonName, title): - global TEMPLATE_LINES - global __lastHarnessType - if TEMPLATE_LINES==None or harnessType!=__lastHarnessType: - __lastHarnessType = harnessType - TEMPLATE_LINES = [] - with open(os.path.join(os.getcwd(), "templates","runner." + harnessType + ".html"), "r") as f: - TEMPLATE_LINES = f.readlines() - fileName = os.path.join(TEST262_ROOT, "website", jsonName.replace(".json", ".html")) - fileNameExists = False - if os.path.exists(fileName): - SC_HELPER.edit(fileName) - fileNameExists = True - with open(fileName, "w") as f: - for line in TEMPLATE_LINES: - if "var TEST_LIST_PATH =" in line: - f.write(" var TEST_LIST_PATH = \"resources/scripts/testcases/" + jsonName + "\";" + os.linesep) - #elif "ECMAScript 5" in line: - # f.write(line.replace("ECMAScript 5", "ECMAScript 5: %s" % title)) - else: - f.write(line) - if not fileNameExists: - SC_HELPER.add(fileName) - -#------------------------------------------------------------------------------ -class SCAbstraction(object): - ''' - A class which abstracts working with source control systems in relation to - generated test262 files. Useful when test262 is also used internally by - browser implementors. - ''' - def edit(self, filename): - ''' - Source control edit of a file. For Mercurial, just make sure it's - writable. - ''' - if not(os.stat(filename).st_mode & stat.S_IWRITE): - os.chmod(filename, stat.S_IWRITE) - - def add(self, filename): - ''' - Source control add of a file. - ''' - subprocess.call(["hg", "add", filename]) - -SC_HELPER = SCAbstraction() \ No newline at end of file diff --git a/tools/TestCaseHTMLPackager/TestUpdater.ps1 b/tools/TestCaseHTMLPackager/TestUpdater.ps1 deleted file mode 100644 index 0bc335ec7..000000000 Binary files a/tools/TestCaseHTMLPackager/TestUpdater.ps1 and /dev/null differ diff --git a/tools/TestCaseHTMLPackager/templates/runner.test262.html b/tools/TestCaseHTMLPackager/templates/runner.test262.html deleted file mode 100644 index 3bfea29f2..000000000 --- a/tools/TestCaseHTMLPackager/templates/runner.test262.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - -ECMAScript Test262 - - - -
- -
-
-
- Loading... - Loading... -
-
-
- -
- -
-
- -
- - -
- -
-

What is test262?

-

test262 is a test suite intended to check agreement between JavaScript implementations and the ECMA-262 Specification (currently 5th Edition). The test suite contains thousands of individual tests, each of which tests some specific requirements of the ECMAScript specification.

-

What is ECMAScript?

-

"ECMAScript" is the name under which the language more commonly known as "JavaScript" is standardized. Development of the ECMAScript standard is the responsibility of Technical Committee 39 (TC39) of Ecma International. The ECMAScript standard is officially known as ECMA-262. ECMAScript 5 (or just ES5) is short hand for the "ECMA-262, 5th Edition ECMAScript Language Specification" the official name of the current edition of the standard. ECMAScript 5 was approved as an official Ecma standard by the Ecma General Assembly on December 3, 2009. The ECMAScript 5 Specification (PDF) is available from the Ecma International web site.

-

Who creates and maintains test262?

-

Development of test262 is a project of Ecma TC39. The testing framework and individual tests are created by member organizations of TC39 and contributed to Ecma for use in test262. For more information about how test262 is developed and maintained click the “Development” tab at the top of this page.

-

What is the status of test262?

-

test262 is not yet complete. It is still undergoing active development. Some portions of the ES5 specification have very complete test coverage while other portions of the specification have only partial test coverage. Some tests may be invalid or may yield false positive or false negative results. A perfect passing score on test262 does not guarantee that a JavaScript implementation perfectly supports ES5. Because tests are being actively added and modified, tests results from different days or times may not be directly comparable. Click the “Development” tab at the top of this page for instructions for reporting test262 bugs.

-

Where can I found out more?

-

Please visit our Frequently Asked Questions section on the ECMAScript Wiki.

- -

Running the Tests

-

Click the “Run” tab at the top of this page for instructions and follow the instructions to run the tests.

- - - -
- -
-

Development

-

Test262 is being developed by the members of Ecma TC39. Ecma's intellectual property policies, permit only Ecma - members to directly contribute code to the project. However, a public mailing list is used to coordinate development of Test262. If you wish to participate in the discussion please subscribe. Bug reports and suggestions should be sent to the mailing list. -

-

- Ecma members can find detailed instructions on Test262 development procedures at the Test262 Wiki. -

-
- -
- -

Please click on the Start button to start the test. Once you start the test you may pause the test anytime by clicking on the Pause button. You can click on the Results tab once the test is completed or after pausing the test. The Reset button is for restarting the test run.

- - -
-
-
-   -
-
-
-

> - Timer Value(ms) : -

- -
- - Tests To Run:  | - Total Tests Ran: | Pass: | Fail: - | Failed To Load: -

-
- -
-
-
-
- Test Suite Ver.:  | Test Suite Date: -
-
- -
-
-
- -
-
-
Total Tests:
- Passed: | Failed: | - Failed To Load: -
- -
-
-
Test results will be displayed after the tests are executed using the Run page.
-
-
- Test Suite Ver.:  | Test Suite Date: -
- -
-  100%  -  75% to 99.9%  -  50% to 75%   -  less than 50% -
-
-
-
- - - - - -- cgit v1.2.3