Browse Source

Split tests.

v0.7.4-release
arlolra 15 years ago
committed by Ryan Dahl
parent
commit
04fac19822
  1. 9
      Makefile
  2. 0
      test/common.js
  3. 0
      test/disabled/test-cat.js
  4. 0
      test/disabled/test-dns.js
  5. 0
      test/disabled/test-eio-race3.js
  6. 0
      test/disabled/test-fs-sendfile.js
  7. 0
      test/disabled/test-http-stress.js
  8. 0
      test/fixtures/a.js
  9. 0
      test/fixtures/b/c.js
  10. 0
      test/fixtures/b/d.js
  11. 0
      test/fixtures/b/package/index.js
  12. 0
      test/fixtures/cycles/folder/foo.js
  13. 0
      test/fixtures/cycles/root.js
  14. 0
      test/fixtures/echo.js
  15. 0
      test/fixtures/multipart.js
  16. 0
      test/fixtures/nested-index/one/hello.js
  17. 0
      test/fixtures/nested-index/one/index.js
  18. 0
      test/fixtures/nested-index/two/hello.js
  19. 0
      test/fixtures/nested-index/two/index.js
  20. 0
      test/fixtures/print-chars.js
  21. 0
      test/fixtures/test_ca.pem
  22. 0
      test/fixtures/test_cert.pem
  23. 0
      test/fixtures/test_key.pem
  24. 0
      test/fixtures/throws_error.js
  25. 0
      test/fixtures/x.txt
  26. 1
      test/internet/internet.status
  27. 21
      test/internet/testcfg.py
  28. 5
      test/mjsunit/test-sync-fileread.js
  29. 1
      test/pummel/pummel.status
  30. 2
      test/pummel/test-http-client-reconnect-bug.js
  31. 2
      test/pummel/test-keep-alive.js
  32. 4
      test/pummel/test-multipart.js
  33. 2
      test/pummel/test-process-spawn-loop.js
  34. 2
      test/pummel/test-tcp-many-clients.js
  35. 2
      test/pummel/test-tcp-pingpong-delay.js
  36. 2
      test/pummel/test-tcp-pingpong.js
  37. 2
      test/pummel/test-tcp-throttle-kernel-buffer.js
  38. 2
      test/pummel/test-tcp-throttle.js
  39. 2
      test/pummel/test-tcp-timeout.js
  40. 2
      test/pummel/test-tcp-tls.js
  41. 2
      test/pummel/test-timers.js
  42. 2
      test/pummel/test-watch-file.js
  43. 108
      test/pummel/testcfg.py
  44. 1
      test/simple/simple.status
  45. 2
      test/simple/test-assert.js
  46. 2
      test/simple/test-byte-length.js
  47. 2
      test/simple/test-chdir.js
  48. 4
      test/simple/test-delayed-require.js
  49. 2
      test/simple/test-eio-race.js
  50. 2
      test/simple/test-eio-race2.js
  51. 2
      test/simple/test-eio-race4.js
  52. 2
      test/simple/test-event-emitter-add-listeners.js
  53. 2
      test/simple/test-event-emitter-modify-in-emit.js
  54. 2
      test/simple/test-exception-handler.js
  55. 2
      test/simple/test-exec.js
  56. 2
      test/simple/test-file-read-noexist.js
  57. 2
      test/simple/test-fs-chmod.js
  58. 2
      test/simple/test-fs-stat.js
  59. 2
      test/simple/test-fs-symlink.js
  60. 2
      test/simple/test-fs-write.js
  61. 2
      test/simple/test-http-1.0.js
  62. 2
      test/simple/test-http-cat.js
  63. 2
      test/simple/test-http-chunked.js
  64. 2
      test/simple/test-http-client-race.js
  65. 2
      test/simple/test-http-client-upload.js
  66. 2
      test/simple/test-http-eof-on-connect.js
  67. 2
      test/simple/test-http-malformed-request.js
  68. 2
      test/simple/test-http-proxy.js
  69. 2
      test/simple/test-http-server.js
  70. 2
      test/simple/test-http-tls.js
  71. 2
      test/simple/test-http-wget.js
  72. 2
      test/simple/test-http.js
  73. 2
      test/simple/test-idle-watcher.js
  74. 2
      test/simple/test-memory-usage.js
  75. 4
      test/simple/test-mkdir-rmdir.js
  76. 26
      test/simple/test-module-loading.js
  77. 2
      test/simple/test-next-tick.js
  78. 4
      test/simple/test-path.js
  79. 2
      test/simple/test-process-buffering.js
  80. 2
      test/simple/test-process-kill.js
  81. 2
      test/simple/test-process-mixin.js
  82. 2
      test/simple/test-process-simple.js
  83. 2
      test/simple/test-querystring.js
  84. 2
      test/simple/test-readdir.js
  85. 2
      test/simple/test-remote-module-loading.js
  86. 2
      test/simple/test-signal-handler.js
  87. 2
      test/simple/test-stdio.js
  88. 2
      test/simple/test-stdout-flush.js
  89. 5
      test/simple/test-sync-fileread.js
  90. 2
      test/simple/test-sys.js
  91. 2
      test/simple/test-tcp-binary.js
  92. 2
      test/simple/test-tcp-reconnect.js
  93. 2
      test/simple/test-umask.js
  94. 2
      test/simple/test-url.js
  95. 2
      test/simple/test-utf8-scripts.js
  96. 108
      test/simple/testcfg.py
  97. 2
      tools/test.py

9
Makefile

@ -24,6 +24,15 @@ test-all: all
test-debug: all test-debug: all
python tools/test.py --mode=debug python tools/test.py --mode=debug
test-simple: all
python tools/test.py simple
test-pummel: all
python tools/test.py pummel
test-internet: all
python tools/test.py internet
benchmark: all benchmark: all
build/default/node benchmark/run.js build/default/node benchmark/run.js

0
test/mjsunit/common.js → test/common.js

0
test/mjsunit/disabled/test-cat.js → test/disabled/test-cat.js

0
test/mjsunit/disabled/test-dns.js → test/disabled/test-dns.js

0
test/mjsunit/disabled/test-eio-race3.js → test/disabled/test-eio-race3.js

0
test/mjsunit/disabled/test-fs-sendfile.js → test/disabled/test-fs-sendfile.js

0
test/mjsunit/disabled/test-http-stress.js → test/disabled/test-http-stress.js

0
test/mjsunit/fixtures/a.js → test/fixtures/a.js

0
test/mjsunit/fixtures/b/c.js → test/fixtures/b/c.js

0
test/mjsunit/fixtures/b/d.js → test/fixtures/b/d.js

0
test/mjsunit/fixtures/b/package/index.js → test/fixtures/b/package/index.js

0
test/mjsunit/fixtures/cycles/folder/foo.js → test/fixtures/cycles/folder/foo.js

0
test/mjsunit/fixtures/cycles/root.js → test/fixtures/cycles/root.js

0
test/mjsunit/fixtures/echo.js → test/fixtures/echo.js

0
test/mjsunit/fixtures/multipart.js → test/fixtures/multipart.js

0
test/mjsunit/fixtures/nested-index/one/hello.js → test/fixtures/nested-index/one/hello.js

0
test/mjsunit/fixtures/nested-index/one/index.js → test/fixtures/nested-index/one/index.js

0
test/mjsunit/fixtures/nested-index/two/hello.js → test/fixtures/nested-index/two/hello.js

0
test/mjsunit/fixtures/nested-index/two/index.js → test/fixtures/nested-index/two/index.js

0
test/mjsunit/fixtures/print-chars.js → test/fixtures/print-chars.js

0
test/mjsunit/fixtures/test_ca.pem → test/fixtures/test_ca.pem

0
test/mjsunit/fixtures/test_cert.pem → test/fixtures/test_cert.pem

0
test/mjsunit/fixtures/test_key.pem → test/fixtures/test_key.pem

0
test/mjsunit/fixtures/throws_error.js → test/fixtures/throws_error.js

0
test/mjsunit/fixtures/x.txt → test/fixtures/x.txt

1
test/internet/internet.status

@ -0,0 +1 @@
prefix internet

21
test/mjsunit/testcfg.py → test/internet/testcfg.py

@ -35,10 +35,10 @@ FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
FILES_PATTERN = re.compile(r"//\s+Files:(.*)") FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
class MjsunitTestCase(test.TestCase): class SimpleTestCase(test.TestCase):
def __init__(self, path, file, mode, context, config): def __init__(self, path, file, mode, context, config):
super(MjsunitTestCase, self).__init__(context, path) super(SimpleTestCase, self).__init__(context, path)
self.file = file self.file = file
self.config = config self.config = config
self.mode = mode self.mode = mode
@ -68,10 +68,10 @@ class MjsunitTestCase(test.TestCase):
return open(self.file).read() return open(self.file).read()
class MjsunitTestConfiguration(test.TestConfiguration): class SimpleTestConfiguration(test.TestConfiguration):
def __init__(self, context, root): def __init__(self, context, root):
super(MjsunitTestConfiguration, self).__init__(context, root) super(SimpleTestConfiguration, self).__init__(context, root)
def Ls(self, path): def Ls(self, path):
def SelectTest(name): def SelectTest(name):
@ -79,27 +79,30 @@ class MjsunitTestConfiguration(test.TestConfiguration):
return [f[:-3] for f in os.listdir(path) if SelectTest(f)] return [f[:-3] for f in os.listdir(path) if SelectTest(f)]
def ListTests(self, current_path, path, mode): def ListTests(self, current_path, path, mode):
mjsunit = [current_path + [t] for t in self.Ls(self.root)] simple = [current_path + [t] for t in self.Ls(self.root)]
#simple = [current_path + ['simple', t] for t in self.Ls(join(self.root, 'simple'))]
#pummel = [current_path + ['pummel', t] for t in self.Ls(join(self.root, 'pummel'))]
#internet = [current_path + ['internet', t] for t in self.Ls(join(self.root, 'internet'))]
#regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))] #regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))]
#bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))] #bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))]
#tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))] #tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))]
all_tests = mjsunit # + regress + bugs + tools all_tests = simple # + regress + bugs + tools
result = [] result = []
for test in all_tests: for test in all_tests:
if self.Contains(path, test): if self.Contains(path, test):
file_path = join(self.root, reduce(join, test[1:], "") + ".js") file_path = join(self.root, reduce(join, test[1:], "") + ".js")
result.append(MjsunitTestCase(test, file_path, mode, self.context, self)) result.append(SimpleTestCase(test, file_path, mode, self.context, self))
return result return result
def GetBuildRequirements(self): def GetBuildRequirements(self):
return ['sample', 'sample=shell'] return ['sample', 'sample=shell']
def GetTestStatus(self, sections, defs): def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'mjsunit.status') status_file = join(self.root, 'simple.status')
if exists(status_file): if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs) test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root): def GetConfiguration(context, root):
return MjsunitTestConfiguration(context, root) return SimpleTestConfiguration(context, root)

5
test/mjsunit/test-sync-fileread.js

@ -1,5 +0,0 @@
process.mixin(require('./common'));
var fixture = path.join(__dirname, "fixtures/x.txt");
assert.equal("xyz\n", fs.readFileSync(fixture));

1
test/pummel/pummel.status

@ -0,0 +1 @@
prefix pummel

2
test/mjsunit/test-http-client-reconnect-bug.js → test/pummel/test-http-client-reconnect-bug.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var tcp = require("tcp"), var tcp = require("tcp"),
sys = require("sys"), sys = require("sys"),

2
test/mjsunit/test-keep-alive.js → test/pummel/test-keep-alive.js

@ -1,5 +1,5 @@
// This test requires the program "ab" // This test requires the program "ab"
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
sys = require("sys"); sys = require("sys");
PORT = 8891; PORT = 8891;

4
test/mjsunit/test-multipart.js → test/pummel/test-multipart.js

@ -1,10 +1,10 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var http = require("http"), var http = require("http"),
multipart = require("multipart"), multipart = require("multipart"),
sys = require("sys"), sys = require("sys"),
PORT = 8222, PORT = 8222,
fixture = require("./fixtures/multipart"), fixture = require("../fixtures/multipart"),
events = require("events"), events = require("events"),
testPart = function (expect, part) { testPart = function (expect, part) {
if (!expect) { if (!expect) {

2
test/mjsunit/test-process-spawn-loop.js → test/pummel/test-process-spawn-loop.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var N = 40; var N = 40;
var finished = false; var finished = false;

2
test/mjsunit/test-tcp-many-clients.js → test/pummel/test-tcp-many-clients.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
// settings // settings
var port = 20743; var port = 20743;

2
test/mjsunit/test-tcp-pingpong-delay.js → test/pummel/test-tcp-pingpong-delay.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");

2
test/mjsunit/test-tcp-pingpong.js → test/pummel/test-tcp-pingpong.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");

2
test/mjsunit/test-tcp-throttle-kernel-buffer.js → test/pummel/test-tcp-throttle-kernel-buffer.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 20444; PORT = 20444;
N = 30*1024; // 500kb N = 30*1024; // 500kb

2
test/mjsunit/test-tcp-throttle.js → test/pummel/test-tcp-throttle.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 20443; PORT = 20443;
N = 200; N = 200;

2
test/mjsunit/test-tcp-timeout.js → test/pummel/test-tcp-timeout.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
port = 9992; port = 9992;
exchanges = 0; exchanges = 0;

2
test/mjsunit/test-tcp-tls.js → test/pummel/test-tcp-tls.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
fs=require("fs"); fs=require("fs");

2
test/mjsunit/test-timers.js → test/pummel/test-timers.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var WINDOW = 200; // why is does this need to be so big? var WINDOW = 200; // why is does this need to be so big?

2
test/mjsunit/test-watch-file.js → test/pummel/test-watch-file.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var path = require("path"); var path = require("path");

108
test/pummel/testcfg.py

@ -0,0 +1,108 @@
# Copyright 2008 the V8 project authors. All rights reserved.
# 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 Google Inc. 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.
import test
import os
from os.path import join, dirname, exists
import re
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
class SimpleTestCase(test.TestCase):
def __init__(self, path, file, mode, context, config):
super(SimpleTestCase, self).__init__(context, path)
self.file = file
self.config = config
self.mode = mode
def GetLabel(self):
return "%s %s" % (self.mode, self.GetName())
def GetName(self):
return self.path[-1]
def GetCommand(self):
result = [self.config.context.GetVm(self.mode)]
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
result += flags_match.group(1).strip().split()
files_match = FILES_PATTERN.search(source);
additional_files = []
if files_match:
additional_files += files_match.group(1).strip().split()
for a_file in additional_files:
result.append(join(dirname(self.config.root), '..', a_file))
result += [self.file]
return result
def GetSource(self):
return open(self.file).read()
class SimpleTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(SimpleTestConfiguration, self).__init__(context, root)
def Ls(self, path):
def SelectTest(name):
return name.startswith('test-') and name.endswith('.js')
return [f[:-3] for f in os.listdir(path) if SelectTest(f)]
def ListTests(self, current_path, path, mode):
simple = [current_path + [t] for t in self.Ls(self.root)]
#simple = [current_path + ['simple', t] for t in self.Ls(join(self.root, 'simple'))]
#pummel = [current_path + ['pummel', t] for t in self.Ls(join(self.root, 'pummel'))]
#internet = [current_path + ['internet', t] for t in self.Ls(join(self.root, 'internet'))]
#regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))]
#bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))]
#tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))]
all_tests = simple # + regress + bugs + tools
result = []
for test in all_tests:
if self.Contains(path, test):
file_path = join(self.root, reduce(join, test[1:], "") + ".js")
result.append(SimpleTestCase(test, file_path, mode, self.context, self))
return result
def GetBuildRequirements(self):
return ['sample', 'sample=shell']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'simple.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return SimpleTestConfiguration(context, root)

1
test/simple/simple.status

@ -0,0 +1 @@
prefix simple

2
test/mjsunit/test-assert.js → test/simple/test-assert.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var a = require('assert'); var a = require('assert');

2
test/mjsunit/test-byte-length.js → test/simple/test-byte-length.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
assert.equal(14, process._byteLength("Il était tué")); assert.equal(14, process._byteLength("Il était tué"));
assert.equal(14, process._byteLength("Il était tué", "utf8")); assert.equal(14, process._byteLength("Il était tué", "utf8"));

2
test/mjsunit/test-chdir.js → test/simple/test-chdir.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var dirname = path.dirname(__filename); var dirname = path.dirname(__filename);

4
test/mjsunit/test-delayed-require.js → test/simple/test-delayed-require.js

@ -1,7 +1,7 @@
process.mixin(require("./common")); process.mixin(require("../common"));
setTimeout(function () { setTimeout(function () {
a = require("./fixtures/a"); a = require("../fixtures/a");
}, 50); }, 50);
process.addListener("exit", function () { process.addListener("exit", function () {

2
test/mjsunit/test-eio-race.js → test/simple/test-eio-race.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var count = 100; var count = 100;
var fs = require('fs'); var fs = require('fs');

2
test/mjsunit/test-eio-race2.js → test/simple/test-eio-race2.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var testTxt = path.join(fixturesDir, "x.txt"); var testTxt = path.join(fixturesDir, "x.txt");
var fs = require('fs'); var fs = require('fs');

2
test/mjsunit/test-eio-race4.js → test/simple/test-eio-race4.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var N = 100; var N = 100;
var j = 0; var j = 0;

2
test/mjsunit/test-event-emitter-add-listeners.js → test/simple/test-event-emitter-add-listeners.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var events = require('events'); var events = require('events');
var e = new events.EventEmitter(); var e = new events.EventEmitter();

2
test/mjsunit/test-event-emitter-modify-in-emit.js → test/simple/test-event-emitter-modify-in-emit.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var events = require('events'); var events = require('events');
var callbacks_called = [ ]; var callbacks_called = [ ];

2
test/mjsunit/test-exception-handler.js → test/simple/test-exception-handler.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var MESSAGE = 'catch me if you can'; var MESSAGE = 'catch me if you can';
var caughtException = false; var caughtException = false;

2
test/mjsunit/test-exec.js → test/simple/test-exec.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
success_count = 0; success_count = 0;
error_count = 0; error_count = 0;

2
test/mjsunit/test-file-read-noexist.js → test/simple/test-file-read-noexist.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var got_error = false; var got_error = false;
var filename = path.join(fixturesDir, "does_not_exist.txt"); var filename = path.join(fixturesDir, "does_not_exist.txt");

2
test/mjsunit/test-fs-chmod.js → test/simple/test-fs-chmod.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var got_error = false; var got_error = false;
var success_count = 0; var success_count = 0;

2
test/mjsunit/test-fs-stat.js → test/simple/test-fs-stat.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var got_error = false; var got_error = false;
var success_count = 0; var success_count = 0;

2
test/mjsunit/test-fs-symlink.js → test/simple/test-fs-symlink.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var completed = 0; var completed = 0;

2
test/mjsunit/test-fs-write.js → test/simple/test-fs-write.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var fn = path.join(fixturesDir, "write.txt"); var fn = path.join(fixturesDir, "write.txt");
var expected = "hello"; var expected = "hello";

2
test/mjsunit/test-http-1.0.js → test/simple/test-http-1.0.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");

2
test/mjsunit/test-http-cat.js → test/simple/test-http-cat.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
PORT = 8888; PORT = 8888;

2
test/mjsunit/test-http-chunked.js → test/simple/test-http-chunked.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var http = require("http"); var http = require("http");
var PORT = 8888; var PORT = 8888;

2
test/mjsunit/test-http-client-race.js → test/simple/test-http-client-race.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888; PORT = 8888;

2
test/mjsunit/test-http-client-upload.js → test/simple/test-http-client-upload.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
var PORT = 18032; var PORT = 18032;

2
test/mjsunit/test-http-eof-on-connect.js → test/simple/test-http-eof-on-connect.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");

2
test/mjsunit/test-http-malformed-request.js → test/simple/test-http-malformed-request.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");
url = require("url"); url = require("url");

2
test/mjsunit/test-http-proxy.js → test/simple/test-http-proxy.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");

2
test/mjsunit/test-http-server.js → test/simple/test-http-server.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");
url = require("url"); url = require("url");

2
test/mjsunit/test-http-tls.js → test/simple/test-http-tls.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888; PORT = 8888;

2
test/mjsunit/test-http-wget.js → test/simple/test-http-wget.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
http = require("http"); http = require("http");

2
test/mjsunit/test-http.js → test/simple/test-http.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
http = require("http"); http = require("http");
url = require("url"); url = require("url");
PORT = 8888; PORT = 8888;

2
test/mjsunit/test-idle-watcher.js → test/simple/test-idle-watcher.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var complete = false; var complete = false;
var idle = new process.IdleWatcher(); var idle = new process.IdleWatcher();

2
test/mjsunit/test-memory-usage.js → test/simple/test-memory-usage.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var r = process.memoryUsage(); var r = process.memoryUsage();
puts(inspect(r)); puts(inspect(r));

4
test/mjsunit/test-mkdir-rmdir.js → test/simple/test-mkdir-rmdir.js

@ -1,7 +1,7 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var dirname = path.dirname(__filename); var dirname = path.dirname(__filename);
var fixtures = path.join(dirname, "fixtures"); var fixtures = path.join(dirname, "../fixtures");
var d = path.join(fixtures, "dir"); var d = path.join(fixtures, "dir");
var mkdir_error = false; var mkdir_error = false;

26
test/mjsunit/test-module-loading.js → test/simple/test-module-loading.js

@ -1,15 +1,15 @@
process.mixin(require("./common")); process.mixin(require("../common"));
debug("load test-module-loading.js"); debug("load test-module-loading.js");
var a = require("./fixtures/a"); var a = require("../fixtures/a");
var c = require("./fixtures/b/c"); var c = require("../fixtures/b/c");
var d = require("./fixtures/b/d"); var d = require("../fixtures/b/d");
var d2 = require("./fixtures/b/d"); var d2 = require("../fixtures/b/d");
// Absolute // Absolute
var d3 = require(__dirname+"/fixtures/b/d"); var d3 = require(path.join(__dirname, "../fixtures/b/d"));
// Relative // Relative
var d4 = require("../mjsunit/fixtures/b/d"); var d4 = require("../fixtures/b/d");
assert.equal(false, false, "testing the test program."); assert.equal(false, false, "testing the test program.");
@ -37,19 +37,19 @@ assert.equal("D", d4.D());
assert.ok((new a.SomeClass) instanceof c.SomeClass); assert.ok((new a.SomeClass) instanceof c.SomeClass);
debug("test index.js modules ids and relative loading") debug("test index.js modules ids and relative loading")
var one = require("./fixtures/nested-index/one"), var one = require("../fixtures/nested-index/one"),
two = require("./fixtures/nested-index/two"); two = require("../fixtures/nested-index/two");
assert.notEqual(one.hello, two.hello); assert.notEqual(one.hello, two.hello);
debug("test cycles containing a .. path"); debug("test cycles containing a .. path");
var root = require("./fixtures/cycles/root"), var root = require("../fixtures/cycles/root"),
foo = require("./fixtures/cycles/folder/foo"); foo = require("../fixtures/cycles/folder/foo");
assert.equal(root.foo, foo); assert.equal(root.foo, foo);
assert.equal(root.sayHello(), root.hello); assert.equal(root.sayHello(), root.hello);
var errorThrown = false; var errorThrown = false;
try { try {
require("./fixtures/throws_error"); require("../fixtures/throws_error");
} catch (e) { } catch (e) {
errorThrown = true; errorThrown = true;
assert.equal("blah", e.message); assert.equal("blah", e.message);
@ -57,7 +57,7 @@ try {
assert.equal(require('path').dirname(__filename), __dirname); assert.equal(require('path').dirname(__filename), __dirname);
require.async('./fixtures/a', function (err, a) { require.async('../fixtures/a', function (err, a) {
if (err) throw err; if (err) throw err;
assert.equal("A", a.A()); assert.equal("A", a.A());
}); });

2
test/mjsunit/test-next-tick.js → test/simple/test-next-tick.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var complete = 0; var complete = 0;

4
test/mjsunit/test-path.js → test/simple/test-path.js

@ -1,12 +1,12 @@
var path = require("path"); var path = require("path");
process.mixin(require("./common")); process.mixin(require("../common"));
var f = __filename; var f = __filename;
assert.equal(path.basename(f), "test-path.js"); assert.equal(path.basename(f), "test-path.js");
assert.equal(path.basename(f, ".js"), "test-path"); assert.equal(path.basename(f, ".js"), "test-path");
assert.equal(path.extname(f), ".js"); assert.equal(path.extname(f), ".js");
assert.equal(path.dirname(f).substr(-13), "/test/mjsunit"); assert.equal(path.dirname(f).substr(-11), "test/simple");
path.exists(f, function (y) { assert.equal(y, true) }); path.exists(f, function (y) { assert.equal(y, true) });
assert.equal(path.join(".", "fixtures/b", "..", "/b/c.js"), "fixtures/b/c.js"); assert.equal(path.join(".", "fixtures/b", "..", "/b/c.js"), "fixtures/b/c.js");

2
test/mjsunit/test-process-buffering.js → test/simple/test-process-buffering.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var pwd_called = false; var pwd_called = false;

2
test/mjsunit/test-process-kill.js → test/simple/test-process-kill.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var exit_status = -1; var exit_status = -1;

2
test/mjsunit/test-process-mixin.js → test/simple/test-process-mixin.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var target = function() {}; var target = function() {};
process.mixin(target, { process.mixin(target, {

2
test/mjsunit/test-process-simple.js → test/simple/test-process-simple.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var cat = process.createChildProcess("cat"); var cat = process.createChildProcess("cat");

2
test/mjsunit/test-querystring.js → test/simple/test-querystring.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
// test using assert // test using assert

2
test/mjsunit/test-readdir.js → test/simple/test-readdir.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var got_error = false; var got_error = false;

2
test/mjsunit/test-remote-module-loading.js → test/simple/test-remote-module-loading.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var PORT = 8889; var PORT = 8889;
var http = require('http'); var http = require('http');

2
test/mjsunit/test-signal-handler.js → test/simple/test-signal-handler.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
puts("process.pid: " + process.pid); puts("process.pid: " + process.pid);

2
test/mjsunit/test-stdio.js → test/simple/test-stdio.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var sub = path.join(fixturesDir, 'echo.js'); var sub = path.join(fixturesDir, 'echo.js');

2
test/mjsunit/test-stdout-flush.js → test/simple/test-stdout-flush.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var sub = path.join(fixturesDir, 'print-chars.js'); var sub = path.join(fixturesDir, 'print-chars.js');

5
test/simple/test-sync-fileread.js

@ -0,0 +1,5 @@
process.mixin(require('../common'));
var fixture = path.join(__dirname, "../fixtures/x.txt");
assert.equal("xyz\n", fs.readFileSync(fixture));

2
test/mjsunit/test-sys.js → test/simple/test-sys.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
process.mixin(require("sys")); process.mixin(require("sys"));
assert.equal("0", inspect(0)); assert.equal("0", inspect(0));

2
test/mjsunit/test-tcp-binary.js → test/simple/test-tcp-binary.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
PORT = 23123; PORT = 23123;

2
test/mjsunit/test-tcp-reconnect.js → test/simple/test-tcp-reconnect.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
tcp = require("tcp"); tcp = require("tcp");
var N = 50; var N = 50;
var port = 8921; var port = 8921;

2
test/mjsunit/test-umask.js → test/simple/test-umask.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var mask = 0664; var mask = 0664;
var old = process.umask(mask); var old = process.umask(mask);

2
test/mjsunit/test-url.js → test/simple/test-url.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
var url = require("url"), var url = require("url"),
sys = require("sys"); sys = require("sys");

2
test/mjsunit/test-utf8-scripts.js → test/simple/test-utf8-scripts.js

@ -1,4 +1,4 @@
process.mixin(require("./common")); process.mixin(require("../common"));
// üäö // üäö

108
test/simple/testcfg.py

@ -0,0 +1,108 @@
# Copyright 2008 the V8 project authors. All rights reserved.
# 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 Google Inc. 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.
import test
import os
from os.path import join, dirname, exists
import re
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
class SimpleTestCase(test.TestCase):
def __init__(self, path, file, mode, context, config):
super(SimpleTestCase, self).__init__(context, path)
self.file = file
self.config = config
self.mode = mode
def GetLabel(self):
return "%s %s" % (self.mode, self.GetName())
def GetName(self):
return self.path[-1]
def GetCommand(self):
result = [self.config.context.GetVm(self.mode)]
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
result += flags_match.group(1).strip().split()
files_match = FILES_PATTERN.search(source);
additional_files = []
if files_match:
additional_files += files_match.group(1).strip().split()
for a_file in additional_files:
result.append(join(dirname(self.config.root), '..', a_file))
result += [self.file]
return result
def GetSource(self):
return open(self.file).read()
class SimpleTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(SimpleTestConfiguration, self).__init__(context, root)
def Ls(self, path):
def SelectTest(name):
return name.startswith('test-') and name.endswith('.js')
return [f[:-3] for f in os.listdir(path) if SelectTest(f)]
def ListTests(self, current_path, path, mode):
simple = [current_path + [t] for t in self.Ls(self.root)]
#simple = [current_path + ['simple', t] for t in self.Ls(join(self.root, 'simple'))]
#pummel = [current_path + ['pummel', t] for t in self.Ls(join(self.root, 'pummel'))]
#internet = [current_path + ['internet', t] for t in self.Ls(join(self.root, 'internet'))]
#regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))]
#bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))]
#tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))]
all_tests = simple # + regress + bugs + tools
result = []
for test in all_tests:
if self.Contains(path, test):
file_path = join(self.root, reduce(join, test[1:], "") + ".js")
result.append(SimpleTestCase(test, file_path, mode, self.context, self))
return result
def GetBuildRequirements(self):
return ['sample', 'sample=shell']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'simple.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return SimpleTestConfiguration(context, root)

2
tools/test.py

@ -1195,7 +1195,7 @@ def GetSpecialCommandProcessor(value):
return ExpandCommand return ExpandCommand
BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message'] BUILT_IN_TESTS = ['simple', 'pummel', 'internet']
def GetSuites(test_root): def GetSuites(test_root):

Loading…
Cancel
Save