From 04fac198225ae48ed7726c15609d254fddce4862 Mon Sep 17 00:00:00 2001 From: arlolra Date: Thu, 25 Feb 2010 01:36:17 -0500 Subject: [PATCH] Split tests. --- Makefile | 9 ++ test/{mjsunit => }/common.js | 0 test/{mjsunit => }/disabled/test-cat.js | 0 test/{mjsunit => }/disabled/test-dns.js | 0 test/{mjsunit => }/disabled/test-eio-race3.js | 0 .../disabled/test-fs-sendfile.js | 0 .../disabled/test-http-stress.js | 0 test/{mjsunit => }/fixtures/a.js | 0 test/{mjsunit => }/fixtures/b/c.js | 0 test/{mjsunit => }/fixtures/b/d.js | 0 .../{mjsunit => }/fixtures/b/package/index.js | 0 .../fixtures/cycles/folder/foo.js | 0 test/{mjsunit => }/fixtures/cycles/root.js | 0 test/{mjsunit => }/fixtures/echo.js | 0 test/{mjsunit => }/fixtures/multipart.js | 0 .../fixtures/nested-index/one/hello.js | 0 .../fixtures/nested-index/one/index.js | 0 .../fixtures/nested-index/two/hello.js | 0 .../fixtures/nested-index/two/index.js | 0 test/{mjsunit => }/fixtures/print-chars.js | 0 test/{mjsunit => }/fixtures/test_ca.pem | 0 test/{mjsunit => }/fixtures/test_cert.pem | 0 test/{mjsunit => }/fixtures/test_key.pem | 0 test/{mjsunit => }/fixtures/throws_error.js | 0 test/{mjsunit => }/fixtures/x.txt | 0 test/internet/internet.status | 1 + test/{mjsunit => internet}/testcfg.py | 21 ++-- test/mjsunit/test-sync-fileread.js | 5 - test/pummel/pummel.status | 1 + .../test-http-client-reconnect-bug.js | 2 +- test/{mjsunit => pummel}/test-keep-alive.js | 2 +- test/{mjsunit => pummel}/test-multipart.js | 4 +- .../test-process-spawn-loop.js | 2 +- .../test-tcp-many-clients.js | 2 +- .../test-tcp-pingpong-delay.js | 2 +- test/{mjsunit => pummel}/test-tcp-pingpong.js | 2 +- .../test-tcp-throttle-kernel-buffer.js | 2 +- test/{mjsunit => pummel}/test-tcp-throttle.js | 2 +- test/{mjsunit => pummel}/test-tcp-timeout.js | 2 +- test/{mjsunit => pummel}/test-tcp-tls.js | 2 +- test/{mjsunit => pummel}/test-timers.js | 2 +- test/{mjsunit => pummel}/test-watch-file.js | 2 +- test/pummel/testcfg.py | 108 ++++++++++++++++++ test/simple/simple.status | 1 + test/{mjsunit => simple}/test-assert.js | 2 +- test/{mjsunit => simple}/test-byte-length.js | 2 +- test/{mjsunit => simple}/test-chdir.js | 2 +- .../test-delayed-require.js | 4 +- test/{mjsunit => simple}/test-eio-race.js | 2 +- test/{mjsunit => simple}/test-eio-race2.js | 2 +- test/{mjsunit => simple}/test-eio-race4.js | 2 +- .../test-event-emitter-add-listeners.js | 2 +- .../test-event-emitter-modify-in-emit.js | 2 +- .../test-exception-handler.js | 2 +- test/{mjsunit => simple}/test-exec.js | 2 +- .../test-file-read-noexist.js | 2 +- test/{mjsunit => simple}/test-fs-chmod.js | 2 +- test/{mjsunit => simple}/test-fs-stat.js | 2 +- test/{mjsunit => simple}/test-fs-symlink.js | 2 +- test/{mjsunit => simple}/test-fs-write.js | 2 +- test/{mjsunit => simple}/test-http-1.0.js | 2 +- test/{mjsunit => simple}/test-http-cat.js | 2 +- test/{mjsunit => simple}/test-http-chunked.js | 2 +- .../test-http-client-race.js | 2 +- .../test-http-client-upload.js | 2 +- .../test-http-eof-on-connect.js | 2 +- .../test-http-malformed-request.js | 2 +- test/{mjsunit => simple}/test-http-proxy.js | 2 +- test/{mjsunit => simple}/test-http-server.js | 2 +- test/{mjsunit => simple}/test-http-tls.js | 2 +- test/{mjsunit => simple}/test-http-wget.js | 2 +- test/{mjsunit => simple}/test-http.js | 2 +- test/{mjsunit => simple}/test-idle-watcher.js | 2 +- test/{mjsunit => simple}/test-memory-usage.js | 2 +- test/{mjsunit => simple}/test-mkdir-rmdir.js | 4 +- .../test-module-loading.js | 26 ++--- test/{mjsunit => simple}/test-next-tick.js | 2 +- test/{mjsunit => simple}/test-path.js | 4 +- .../test-process-buffering.js | 2 +- test/{mjsunit => simple}/test-process-kill.js | 2 +- .../{mjsunit => simple}/test-process-mixin.js | 2 +- .../test-process-simple.js | 2 +- test/{mjsunit => simple}/test-querystring.js | 2 +- test/{mjsunit => simple}/test-readdir.js | 2 +- .../test-remote-module-loading.js | 2 +- .../test-signal-handler.js | 2 +- test/{mjsunit => simple}/test-stdio.js | 2 +- test/{mjsunit => simple}/test-stdout-flush.js | 2 +- test/simple/test-sync-fileread.js | 5 + test/{mjsunit => simple}/test-sys.js | 2 +- test/{mjsunit => simple}/test-tcp-binary.js | 2 +- .../{mjsunit => simple}/test-tcp-reconnect.js | 2 +- test/{mjsunit => simple}/test-umask.js | 2 +- test/{mjsunit => simple}/test-url.js | 2 +- test/{mjsunit => simple}/test-utf8-scripts.js | 2 +- test/simple/testcfg.py | 108 ++++++++++++++++++ tools/test.py | 2 +- 97 files changed, 325 insertions(+), 94 deletions(-) rename test/{mjsunit => }/common.js (100%) rename test/{mjsunit => }/disabled/test-cat.js (100%) rename test/{mjsunit => }/disabled/test-dns.js (100%) rename test/{mjsunit => }/disabled/test-eio-race3.js (100%) rename test/{mjsunit => }/disabled/test-fs-sendfile.js (100%) rename test/{mjsunit => }/disabled/test-http-stress.js (100%) rename test/{mjsunit => }/fixtures/a.js (100%) rename test/{mjsunit => }/fixtures/b/c.js (100%) rename test/{mjsunit => }/fixtures/b/d.js (100%) rename test/{mjsunit => }/fixtures/b/package/index.js (100%) rename test/{mjsunit => }/fixtures/cycles/folder/foo.js (100%) rename test/{mjsunit => }/fixtures/cycles/root.js (100%) rename test/{mjsunit => }/fixtures/echo.js (100%) rename test/{mjsunit => }/fixtures/multipart.js (100%) rename test/{mjsunit => }/fixtures/nested-index/one/hello.js (100%) rename test/{mjsunit => }/fixtures/nested-index/one/index.js (100%) rename test/{mjsunit => }/fixtures/nested-index/two/hello.js (100%) rename test/{mjsunit => }/fixtures/nested-index/two/index.js (100%) rename test/{mjsunit => }/fixtures/print-chars.js (100%) rename test/{mjsunit => }/fixtures/test_ca.pem (100%) rename test/{mjsunit => }/fixtures/test_cert.pem (100%) rename test/{mjsunit => }/fixtures/test_key.pem (100%) rename test/{mjsunit => }/fixtures/throws_error.js (100%) rename test/{mjsunit => }/fixtures/x.txt (100%) create mode 100644 test/internet/internet.status rename test/{mjsunit => internet}/testcfg.py (81%) delete mode 100644 test/mjsunit/test-sync-fileread.js create mode 100644 test/pummel/pummel.status rename test/{mjsunit => pummel}/test-http-client-reconnect-bug.js (95%) rename test/{mjsunit => pummel}/test-keep-alive.js (97%) rename test/{mjsunit => pummel}/test-multipart.js (97%) rename test/{mjsunit => pummel}/test-process-spawn-loop.js (94%) rename test/{mjsunit => pummel}/test-tcp-many-clients.js (97%) rename test/{mjsunit => pummel}/test-tcp-pingpong-delay.js (98%) rename test/{mjsunit => pummel}/test-tcp-pingpong.js (98%) rename test/{mjsunit => pummel}/test-tcp-throttle-kernel-buffer.js (96%) rename test/{mjsunit => pummel}/test-tcp-throttle.js (97%) rename test/{mjsunit => pummel}/test-tcp-timeout.js (98%) rename test/{mjsunit => pummel}/test-tcp-tls.js (98%) rename test/{mjsunit => pummel}/test-timers.js (97%) rename test/{mjsunit => pummel}/test-watch-file.js (93%) create mode 100644 test/pummel/testcfg.py create mode 100644 test/simple/simple.status rename test/{mjsunit => simple}/test-assert.js (99%) rename test/{mjsunit => simple}/test-byte-length.js (90%) rename test/{mjsunit => simple}/test-chdir.js (81%) rename test/{mjsunit => simple}/test-delayed-require.js (71%) rename test/{mjsunit => simple}/test-eio-race.js (97%) rename test/{mjsunit => simple}/test-eio-race2.js (92%) rename test/{mjsunit => simple}/test-eio-race4.js (90%) rename test/{mjsunit => simple}/test-event-emitter-add-listeners.js (94%) rename test/{mjsunit => simple}/test-event-emitter-modify-in-emit.js (95%) rename test/{mjsunit => simple}/test-exception-handler.js (93%) rename test/{mjsunit => simple}/test-exec.js (95%) rename test/{mjsunit => simple}/test-file-read-noexist.js (92%) rename test/{mjsunit => simple}/test-fs-chmod.js (93%) rename test/{mjsunit => simple}/test-fs-stat.js (97%) rename test/{mjsunit => simple}/test-fs-symlink.js (96%) rename test/{mjsunit => simple}/test-fs-write.js (94%) rename test/{mjsunit => simple}/test-http-1.0.js (95%) rename test/{mjsunit => simple}/test-http-cat.js (96%) rename test/{mjsunit => simple}/test-http-chunked.js (92%) rename test/{mjsunit => simple}/test-http-client-race.js (96%) rename test/{mjsunit => simple}/test-http-client-upload.js (97%) rename test/{mjsunit => simple}/test-http-eof-on-connect.js (93%) rename test/{mjsunit => simple}/test-http-malformed-request.js (95%) rename test/{mjsunit => simple}/test-http-proxy.js (97%) rename test/{mjsunit => simple}/test-http-server.js (98%) rename test/{mjsunit => simple}/test-http-tls.js (98%) rename test/{mjsunit => simple}/test-http-wget.js (97%) rename test/{mjsunit => simple}/test-http.js (98%) rename test/{mjsunit => simple}/test-idle-watcher.js (87%) rename test/{mjsunit => simple}/test-memory-usage.js (76%) rename test/{mjsunit => simple}/test-mkdir-rmdir.js (87%) rename test/{mjsunit => simple}/test-module-loading.js (74%) rename test/{mjsunit => simple}/test-next-tick.js (91%) rename test/{mjsunit => simple}/test-path.js (91%) rename test/{mjsunit => simple}/test-process-buffering.js (94%) rename test/{mjsunit => simple}/test-process-kill.js (91%) rename test/{mjsunit => simple}/test-process-mixin.js (96%) rename test/{mjsunit => simple}/test-process-simple.js (95%) rename test/{mjsunit => simple}/test-querystring.js (99%) rename test/{mjsunit => simple}/test-readdir.js (95%) rename test/{mjsunit => simple}/test-remote-module-loading.js (96%) rename test/{mjsunit => simple}/test-signal-handler.js (93%) rename test/{mjsunit => simple}/test-stdio.js (95%) rename test/{mjsunit => simple}/test-stdout-flush.js (92%) create mode 100644 test/simple/test-sync-fileread.js rename test/{mjsunit => simple}/test-sys.js (98%) rename test/{mjsunit => simple}/test-tcp-binary.js (97%) rename test/{mjsunit => simple}/test-tcp-reconnect.js (96%) rename test/{mjsunit => simple}/test-umask.js (72%) rename test/{mjsunit => simple}/test-url.js (99%) rename test/{mjsunit => simple}/test-utf8-scripts.js (78%) create mode 100644 test/simple/testcfg.py diff --git a/Makefile b/Makefile index 2776d42507..67c56e2d28 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,15 @@ test-all: all test-debug: all 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 build/default/node benchmark/run.js diff --git a/test/mjsunit/common.js b/test/common.js similarity index 100% rename from test/mjsunit/common.js rename to test/common.js diff --git a/test/mjsunit/disabled/test-cat.js b/test/disabled/test-cat.js similarity index 100% rename from test/mjsunit/disabled/test-cat.js rename to test/disabled/test-cat.js diff --git a/test/mjsunit/disabled/test-dns.js b/test/disabled/test-dns.js similarity index 100% rename from test/mjsunit/disabled/test-dns.js rename to test/disabled/test-dns.js diff --git a/test/mjsunit/disabled/test-eio-race3.js b/test/disabled/test-eio-race3.js similarity index 100% rename from test/mjsunit/disabled/test-eio-race3.js rename to test/disabled/test-eio-race3.js diff --git a/test/mjsunit/disabled/test-fs-sendfile.js b/test/disabled/test-fs-sendfile.js similarity index 100% rename from test/mjsunit/disabled/test-fs-sendfile.js rename to test/disabled/test-fs-sendfile.js diff --git a/test/mjsunit/disabled/test-http-stress.js b/test/disabled/test-http-stress.js similarity index 100% rename from test/mjsunit/disabled/test-http-stress.js rename to test/disabled/test-http-stress.js diff --git a/test/mjsunit/fixtures/a.js b/test/fixtures/a.js similarity index 100% rename from test/mjsunit/fixtures/a.js rename to test/fixtures/a.js diff --git a/test/mjsunit/fixtures/b/c.js b/test/fixtures/b/c.js similarity index 100% rename from test/mjsunit/fixtures/b/c.js rename to test/fixtures/b/c.js diff --git a/test/mjsunit/fixtures/b/d.js b/test/fixtures/b/d.js similarity index 100% rename from test/mjsunit/fixtures/b/d.js rename to test/fixtures/b/d.js diff --git a/test/mjsunit/fixtures/b/package/index.js b/test/fixtures/b/package/index.js similarity index 100% rename from test/mjsunit/fixtures/b/package/index.js rename to test/fixtures/b/package/index.js diff --git a/test/mjsunit/fixtures/cycles/folder/foo.js b/test/fixtures/cycles/folder/foo.js similarity index 100% rename from test/mjsunit/fixtures/cycles/folder/foo.js rename to test/fixtures/cycles/folder/foo.js diff --git a/test/mjsunit/fixtures/cycles/root.js b/test/fixtures/cycles/root.js similarity index 100% rename from test/mjsunit/fixtures/cycles/root.js rename to test/fixtures/cycles/root.js diff --git a/test/mjsunit/fixtures/echo.js b/test/fixtures/echo.js similarity index 100% rename from test/mjsunit/fixtures/echo.js rename to test/fixtures/echo.js diff --git a/test/mjsunit/fixtures/multipart.js b/test/fixtures/multipart.js similarity index 100% rename from test/mjsunit/fixtures/multipart.js rename to test/fixtures/multipart.js diff --git a/test/mjsunit/fixtures/nested-index/one/hello.js b/test/fixtures/nested-index/one/hello.js similarity index 100% rename from test/mjsunit/fixtures/nested-index/one/hello.js rename to test/fixtures/nested-index/one/hello.js diff --git a/test/mjsunit/fixtures/nested-index/one/index.js b/test/fixtures/nested-index/one/index.js similarity index 100% rename from test/mjsunit/fixtures/nested-index/one/index.js rename to test/fixtures/nested-index/one/index.js diff --git a/test/mjsunit/fixtures/nested-index/two/hello.js b/test/fixtures/nested-index/two/hello.js similarity index 100% rename from test/mjsunit/fixtures/nested-index/two/hello.js rename to test/fixtures/nested-index/two/hello.js diff --git a/test/mjsunit/fixtures/nested-index/two/index.js b/test/fixtures/nested-index/two/index.js similarity index 100% rename from test/mjsunit/fixtures/nested-index/two/index.js rename to test/fixtures/nested-index/two/index.js diff --git a/test/mjsunit/fixtures/print-chars.js b/test/fixtures/print-chars.js similarity index 100% rename from test/mjsunit/fixtures/print-chars.js rename to test/fixtures/print-chars.js diff --git a/test/mjsunit/fixtures/test_ca.pem b/test/fixtures/test_ca.pem similarity index 100% rename from test/mjsunit/fixtures/test_ca.pem rename to test/fixtures/test_ca.pem diff --git a/test/mjsunit/fixtures/test_cert.pem b/test/fixtures/test_cert.pem similarity index 100% rename from test/mjsunit/fixtures/test_cert.pem rename to test/fixtures/test_cert.pem diff --git a/test/mjsunit/fixtures/test_key.pem b/test/fixtures/test_key.pem similarity index 100% rename from test/mjsunit/fixtures/test_key.pem rename to test/fixtures/test_key.pem diff --git a/test/mjsunit/fixtures/throws_error.js b/test/fixtures/throws_error.js similarity index 100% rename from test/mjsunit/fixtures/throws_error.js rename to test/fixtures/throws_error.js diff --git a/test/mjsunit/fixtures/x.txt b/test/fixtures/x.txt similarity index 100% rename from test/mjsunit/fixtures/x.txt rename to test/fixtures/x.txt diff --git a/test/internet/internet.status b/test/internet/internet.status new file mode 100644 index 0000000000..34aea6a6af --- /dev/null +++ b/test/internet/internet.status @@ -0,0 +1 @@ +prefix internet diff --git a/test/mjsunit/testcfg.py b/test/internet/testcfg.py similarity index 81% rename from test/mjsunit/testcfg.py rename to test/internet/testcfg.py index 5e74466acf..7d730edebd 100644 --- a/test/mjsunit/testcfg.py +++ b/test/internet/testcfg.py @@ -35,10 +35,10 @@ FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") FILES_PATTERN = re.compile(r"//\s+Files:(.*)") -class MjsunitTestCase(test.TestCase): +class SimpleTestCase(test.TestCase): def __init__(self, path, file, mode, context, config): - super(MjsunitTestCase, self).__init__(context, path) + super(SimpleTestCase, self).__init__(context, path) self.file = file self.config = config self.mode = mode @@ -68,10 +68,10 @@ class MjsunitTestCase(test.TestCase): return open(self.file).read() -class MjsunitTestConfiguration(test.TestConfiguration): +class SimpleTestConfiguration(test.TestConfiguration): def __init__(self, context, root): - super(MjsunitTestConfiguration, self).__init__(context, root) + super(SimpleTestConfiguration, self).__init__(context, root) def Ls(self, path): def SelectTest(name): @@ -79,27 +79,30 @@ class MjsunitTestConfiguration(test.TestConfiguration): return [f[:-3] for f in os.listdir(path) if SelectTest(f)] 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'))] #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 = mjsunit # + regress + bugs + 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(MjsunitTestCase(test, file_path, mode, self.context, self)) + 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, 'mjsunit.status') + status_file = join(self.root, 'simple.status') if exists(status_file): test.ReadConfigurationInto(status_file, sections, defs) def GetConfiguration(context, root): - return MjsunitTestConfiguration(context, root) + return SimpleTestConfiguration(context, root) diff --git a/test/mjsunit/test-sync-fileread.js b/test/mjsunit/test-sync-fileread.js deleted file mode 100644 index 8c337ee0a9..0000000000 --- a/test/mjsunit/test-sync-fileread.js +++ /dev/null @@ -1,5 +0,0 @@ -process.mixin(require('./common')); - -var fixture = path.join(__dirname, "fixtures/x.txt"); - -assert.equal("xyz\n", fs.readFileSync(fixture)); diff --git a/test/pummel/pummel.status b/test/pummel/pummel.status new file mode 100644 index 0000000000..87224bb70b --- /dev/null +++ b/test/pummel/pummel.status @@ -0,0 +1 @@ +prefix pummel diff --git a/test/mjsunit/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js similarity index 95% rename from test/mjsunit/test-http-client-reconnect-bug.js rename to test/pummel/test-http-client-reconnect-bug.js index 29a9feecff..0440a52a1f 100644 --- a/test/mjsunit/test-http-client-reconnect-bug.js +++ b/test/pummel/test-http-client-reconnect-bug.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var tcp = require("tcp"), sys = require("sys"), diff --git a/test/mjsunit/test-keep-alive.js b/test/pummel/test-keep-alive.js similarity index 97% rename from test/mjsunit/test-keep-alive.js rename to test/pummel/test-keep-alive.js index f4d2933bb3..4b8dc93ea7 100644 --- a/test/mjsunit/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -1,5 +1,5 @@ // This test requires the program "ab" -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); sys = require("sys"); PORT = 8891; diff --git a/test/mjsunit/test-multipart.js b/test/pummel/test-multipart.js similarity index 97% rename from test/mjsunit/test-multipart.js rename to test/pummel/test-multipart.js index ba10b60d47..b542e99acc 100644 --- a/test/mjsunit/test-multipart.js +++ b/test/pummel/test-multipart.js @@ -1,10 +1,10 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var http = require("http"), multipart = require("multipart"), sys = require("sys"), PORT = 8222, - fixture = require("./fixtures/multipart"), + fixture = require("../fixtures/multipart"), events = require("events"), testPart = function (expect, part) { if (!expect) { diff --git a/test/mjsunit/test-process-spawn-loop.js b/test/pummel/test-process-spawn-loop.js similarity index 94% rename from test/mjsunit/test-process-spawn-loop.js rename to test/pummel/test-process-spawn-loop.js index 2453451a38..9a639ee9f1 100644 --- a/test/mjsunit/test-process-spawn-loop.js +++ b/test/pummel/test-process-spawn-loop.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var N = 40; var finished = false; diff --git a/test/mjsunit/test-tcp-many-clients.js b/test/pummel/test-tcp-many-clients.js similarity index 97% rename from test/mjsunit/test-tcp-many-clients.js rename to test/pummel/test-tcp-many-clients.js index 5d229834d1..4653733faa 100644 --- a/test/mjsunit/test-tcp-many-clients.js +++ b/test/pummel/test-tcp-many-clients.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); // settings var port = 20743; diff --git a/test/mjsunit/test-tcp-pingpong-delay.js b/test/pummel/test-tcp-pingpong-delay.js similarity index 98% rename from test/mjsunit/test-tcp-pingpong-delay.js rename to test/pummel/test-tcp-pingpong-delay.js index b8d2d06451..ae6868a8a2 100644 --- a/test/mjsunit/test-tcp-pingpong-delay.js +++ b/test/pummel/test-tcp-pingpong-delay.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); diff --git a/test/mjsunit/test-tcp-pingpong.js b/test/pummel/test-tcp-pingpong.js similarity index 98% rename from test/mjsunit/test-tcp-pingpong.js rename to test/pummel/test-tcp-pingpong.js index 3f067be2fb..75e302c5f9 100644 --- a/test/mjsunit/test-tcp-pingpong.js +++ b/test/pummel/test-tcp-pingpong.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); diff --git a/test/mjsunit/test-tcp-throttle-kernel-buffer.js b/test/pummel/test-tcp-throttle-kernel-buffer.js similarity index 96% rename from test/mjsunit/test-tcp-throttle-kernel-buffer.js rename to test/pummel/test-tcp-throttle-kernel-buffer.js index a8fab1f5b3..6f966fbc88 100644 --- a/test/mjsunit/test-tcp-throttle-kernel-buffer.js +++ b/test/pummel/test-tcp-throttle-kernel-buffer.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); PORT = 20444; N = 30*1024; // 500kb diff --git a/test/mjsunit/test-tcp-throttle.js b/test/pummel/test-tcp-throttle.js similarity index 97% rename from test/mjsunit/test-tcp-throttle.js rename to test/pummel/test-tcp-throttle.js index 7e927d2d05..57ccec190a 100644 --- a/test/mjsunit/test-tcp-throttle.js +++ b/test/pummel/test-tcp-throttle.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); PORT = 20443; N = 200; diff --git a/test/mjsunit/test-tcp-timeout.js b/test/pummel/test-tcp-timeout.js similarity index 98% rename from test/mjsunit/test-tcp-timeout.js rename to test/pummel/test-tcp-timeout.js index b2f363d2da..1fd95540cb 100644 --- a/test/mjsunit/test-tcp-timeout.js +++ b/test/pummel/test-tcp-timeout.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); port = 9992; exchanges = 0; diff --git a/test/mjsunit/test-tcp-tls.js b/test/pummel/test-tcp-tls.js similarity index 98% rename from test/mjsunit/test-tcp-tls.js rename to test/pummel/test-tcp-tls.js index b823780ebc..0635ea58dc 100644 --- a/test/mjsunit/test-tcp-tls.js +++ b/test/pummel/test-tcp-tls.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); fs=require("fs"); diff --git a/test/mjsunit/test-timers.js b/test/pummel/test-timers.js similarity index 97% rename from test/mjsunit/test-timers.js rename to test/pummel/test-timers.js index f97ff85662..853df08ae3 100644 --- a/test/mjsunit/test-timers.js +++ b/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? diff --git a/test/mjsunit/test-watch-file.js b/test/pummel/test-watch-file.js similarity index 93% rename from test/mjsunit/test-watch-file.js rename to test/pummel/test-watch-file.js index 977e5838ab..1c235d6d17 100644 --- a/test/mjsunit/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var path = require("path"); diff --git a/test/pummel/testcfg.py b/test/pummel/testcfg.py new file mode 100644 index 0000000000..7d730edebd --- /dev/null +++ b/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) diff --git a/test/simple/simple.status b/test/simple/simple.status new file mode 100644 index 0000000000..438ce39f5f --- /dev/null +++ b/test/simple/simple.status @@ -0,0 +1 @@ +prefix simple diff --git a/test/mjsunit/test-assert.js b/test/simple/test-assert.js similarity index 99% rename from test/mjsunit/test-assert.js rename to test/simple/test-assert.js index d8d546a901..ea725f284c 100644 --- a/test/mjsunit/test-assert.js +++ b/test/simple/test-assert.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var a = require('assert'); diff --git a/test/mjsunit/test-byte-length.js b/test/simple/test-byte-length.js similarity index 90% rename from test/mjsunit/test-byte-length.js rename to test/simple/test-byte-length.js index 246a33dcda..cd0f2c4814 100644 --- a/test/mjsunit/test-byte-length.js +++ b/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é", "utf8")); diff --git a/test/mjsunit/test-chdir.js b/test/simple/test-chdir.js similarity index 81% rename from test/mjsunit/test-chdir.js rename to test/simple/test-chdir.js index bd7f065d1d..1fd58ddaf6 100644 --- a/test/mjsunit/test-chdir.js +++ b/test/simple/test-chdir.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var dirname = path.dirname(__filename); diff --git a/test/mjsunit/test-delayed-require.js b/test/simple/test-delayed-require.js similarity index 71% rename from test/mjsunit/test-delayed-require.js rename to test/simple/test-delayed-require.js index a9172687d6..ed9b9d8562 100644 --- a/test/mjsunit/test-delayed-require.js +++ b/test/simple/test-delayed-require.js @@ -1,7 +1,7 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); setTimeout(function () { - a = require("./fixtures/a"); + a = require("../fixtures/a"); }, 50); process.addListener("exit", function () { diff --git a/test/mjsunit/test-eio-race.js b/test/simple/test-eio-race.js similarity index 97% rename from test/mjsunit/test-eio-race.js rename to test/simple/test-eio-race.js index 0245d5dbc6..bb9045ce13 100644 --- a/test/mjsunit/test-eio-race.js +++ b/test/simple/test-eio-race.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var count = 100; var fs = require('fs'); diff --git a/test/mjsunit/test-eio-race2.js b/test/simple/test-eio-race2.js similarity index 92% rename from test/mjsunit/test-eio-race2.js rename to test/simple/test-eio-race2.js index d41f37c6f6..11f989a61a 100644 --- a/test/mjsunit/test-eio-race2.js +++ b/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 fs = require('fs'); diff --git a/test/mjsunit/test-eio-race4.js b/test/simple/test-eio-race4.js similarity index 90% rename from test/mjsunit/test-eio-race4.js rename to test/simple/test-eio-race4.js index 7004ee80a4..1792798284 100644 --- a/test/mjsunit/test-eio-race4.js +++ b/test/simple/test-eio-race4.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var N = 100; var j = 0; diff --git a/test/mjsunit/test-event-emitter-add-listeners.js b/test/simple/test-event-emitter-add-listeners.js similarity index 94% rename from test/mjsunit/test-event-emitter-add-listeners.js rename to test/simple/test-event-emitter-add-listeners.js index 643b8d8dde..2294372050 100644 --- a/test/mjsunit/test-event-emitter-add-listeners.js +++ b/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 e = new events.EventEmitter(); diff --git a/test/mjsunit/test-event-emitter-modify-in-emit.js b/test/simple/test-event-emitter-modify-in-emit.js similarity index 95% rename from test/mjsunit/test-event-emitter-modify-in-emit.js rename to test/simple/test-event-emitter-modify-in-emit.js index 7bb2eb3292..cfd31ca519 100644 --- a/test/mjsunit/test-event-emitter-modify-in-emit.js +++ b/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 callbacks_called = [ ]; diff --git a/test/mjsunit/test-exception-handler.js b/test/simple/test-exception-handler.js similarity index 93% rename from test/mjsunit/test-exception-handler.js rename to test/simple/test-exception-handler.js index 3fc82cfe5e..fab4e44a44 100644 --- a/test/mjsunit/test-exception-handler.js +++ b/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 caughtException = false; diff --git a/test/mjsunit/test-exec.js b/test/simple/test-exec.js similarity index 95% rename from test/mjsunit/test-exec.js rename to test/simple/test-exec.js index f817ebd696..7f9dd8db17 100644 --- a/test/mjsunit/test-exec.js +++ b/test/simple/test-exec.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); success_count = 0; error_count = 0; diff --git a/test/mjsunit/test-file-read-noexist.js b/test/simple/test-file-read-noexist.js similarity index 92% rename from test/mjsunit/test-file-read-noexist.js rename to test/simple/test-file-read-noexist.js index da28964165..a68c4662c6 100644 --- a/test/mjsunit/test-file-read-noexist.js +++ b/test/simple/test-file-read-noexist.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var got_error = false; var filename = path.join(fixturesDir, "does_not_exist.txt"); diff --git a/test/mjsunit/test-fs-chmod.js b/test/simple/test-fs-chmod.js similarity index 93% rename from test/mjsunit/test-fs-chmod.js rename to test/simple/test-fs-chmod.js index 71bd5b7d70..c4a7829b15 100644 --- a/test/mjsunit/test-fs-chmod.js +++ b/test/simple/test-fs-chmod.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var got_error = false; var success_count = 0; diff --git a/test/mjsunit/test-fs-stat.js b/test/simple/test-fs-stat.js similarity index 97% rename from test/mjsunit/test-fs-stat.js rename to test/simple/test-fs-stat.js index cea18a2e11..088ad696a9 100644 --- a/test/mjsunit/test-fs-stat.js +++ b/test/simple/test-fs-stat.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var got_error = false; var success_count = 0; diff --git a/test/mjsunit/test-fs-symlink.js b/test/simple/test-fs-symlink.js similarity index 96% rename from test/mjsunit/test-fs-symlink.js rename to test/simple/test-fs-symlink.js index 2bf1e82df3..ac9a3ab803 100644 --- a/test/mjsunit/test-fs-symlink.js +++ b/test/simple/test-fs-symlink.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var completed = 0; diff --git a/test/mjsunit/test-fs-write.js b/test/simple/test-fs-write.js similarity index 94% rename from test/mjsunit/test-fs-write.js rename to test/simple/test-fs-write.js index 33b6d01e50..d2bd1d581e 100644 --- a/test/mjsunit/test-fs-write.js +++ b/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 expected = "hello"; diff --git a/test/mjsunit/test-http-1.0.js b/test/simple/test-http-1.0.js similarity index 95% rename from test/mjsunit/test-http-1.0.js rename to test/simple/test-http-1.0.js index 911cb1ca0d..801972ca2f 100644 --- a/test/mjsunit/test-http-1.0.js +++ b/test/simple/test-http-1.0.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); http = require("http"); diff --git a/test/mjsunit/test-http-cat.js b/test/simple/test-http-cat.js similarity index 96% rename from test/mjsunit/test-http-cat.js rename to test/simple/test-http-cat.js index bda98c15b9..9e26b4b3a4 100644 --- a/test/mjsunit/test-http-cat.js +++ b/test/simple/test-http-cat.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); PORT = 8888; diff --git a/test/mjsunit/test-http-chunked.js b/test/simple/test-http-chunked.js similarity index 92% rename from test/mjsunit/test-http-chunked.js rename to test/simple/test-http-chunked.js index d94b8a253e..f1895737b1 100644 --- a/test/mjsunit/test-http-chunked.js +++ b/test/simple/test-http-chunked.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var http = require("http"); var PORT = 8888; diff --git a/test/mjsunit/test-http-client-race.js b/test/simple/test-http-client-race.js similarity index 96% rename from test/mjsunit/test-http-client-race.js rename to test/simple/test-http-client-race.js index b1f1237c21..3541830f06 100644 --- a/test/mjsunit/test-http-client-race.js +++ b/test/simple/test-http-client-race.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); url = require("url"); PORT = 8888; diff --git a/test/mjsunit/test-http-client-upload.js b/test/simple/test-http-client-upload.js similarity index 97% rename from test/mjsunit/test-http-client-upload.js rename to test/simple/test-http-client-upload.js index dbe36e1863..880b229f29 100644 --- a/test/mjsunit/test-http-client-upload.js +++ b/test/simple/test-http-client-upload.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); var PORT = 18032; diff --git a/test/mjsunit/test-http-eof-on-connect.js b/test/simple/test-http-eof-on-connect.js similarity index 93% rename from test/mjsunit/test-http-eof-on-connect.js rename to test/simple/test-http-eof-on-connect.js index a385c377f3..6be2e71a66 100644 --- a/test/mjsunit/test-http-eof-on-connect.js +++ b/test/simple/test-http-eof-on-connect.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); http = require("http"); diff --git a/test/mjsunit/test-http-malformed-request.js b/test/simple/test-http-malformed-request.js similarity index 95% rename from test/mjsunit/test-http-malformed-request.js rename to test/simple/test-http-malformed-request.js index 5397e9f5ed..5d2efc17f2 100644 --- a/test/mjsunit/test-http-malformed-request.js +++ b/test/simple/test-http-malformed-request.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); http = require("http"); url = require("url"); diff --git a/test/mjsunit/test-http-proxy.js b/test/simple/test-http-proxy.js similarity index 97% rename from test/mjsunit/test-http-proxy.js rename to test/simple/test-http-proxy.js index d11d2dd6aa..5f7bac5269 100644 --- a/test/mjsunit/test-http-proxy.js +++ b/test/simple/test-http-proxy.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); url = require("url"); diff --git a/test/mjsunit/test-http-server.js b/test/simple/test-http-server.js similarity index 98% rename from test/mjsunit/test-http-server.js rename to test/simple/test-http-server.js index fe569ce42d..b9f48000ca 100644 --- a/test/mjsunit/test-http-server.js +++ b/test/simple/test-http-server.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); http = require("http"); url = require("url"); diff --git a/test/mjsunit/test-http-tls.js b/test/simple/test-http-tls.js similarity index 98% rename from test/mjsunit/test-http-tls.js rename to test/simple/test-http-tls.js index ffe042c1f4..9931982894 100644 --- a/test/mjsunit/test-http-tls.js +++ b/test/simple/test-http-tls.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); url = require("url"); PORT = 8888; diff --git a/test/mjsunit/test-http-wget.js b/test/simple/test-http-wget.js similarity index 97% rename from test/mjsunit/test-http-wget.js rename to test/simple/test-http-wget.js index 931fe44ddb..5563a3dd70 100644 --- a/test/mjsunit/test-http-wget.js +++ b/test/simple/test-http-wget.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); http = require("http"); diff --git a/test/mjsunit/test-http.js b/test/simple/test-http.js similarity index 98% rename from test/mjsunit/test-http.js rename to test/simple/test-http.js index 83daac910a..b5ecdbef20 100644 --- a/test/mjsunit/test-http.js +++ b/test/simple/test-http.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); http = require("http"); url = require("url"); PORT = 8888; diff --git a/test/mjsunit/test-idle-watcher.js b/test/simple/test-idle-watcher.js similarity index 87% rename from test/mjsunit/test-idle-watcher.js rename to test/simple/test-idle-watcher.js index cd037fb442..8bfca5dfaa 100644 --- a/test/mjsunit/test-idle-watcher.js +++ b/test/simple/test-idle-watcher.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var complete = false; var idle = new process.IdleWatcher(); diff --git a/test/mjsunit/test-memory-usage.js b/test/simple/test-memory-usage.js similarity index 76% rename from test/mjsunit/test-memory-usage.js rename to test/simple/test-memory-usage.js index 8b9c55d1f4..8a2a29fc64 100644 --- a/test/mjsunit/test-memory-usage.js +++ b/test/simple/test-memory-usage.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var r = process.memoryUsage(); puts(inspect(r)); diff --git a/test/mjsunit/test-mkdir-rmdir.js b/test/simple/test-mkdir-rmdir.js similarity index 87% rename from test/mjsunit/test-mkdir-rmdir.js rename to test/simple/test-mkdir-rmdir.js index 9e3f78734d..b19d6ac295 100644 --- a/test/mjsunit/test-mkdir-rmdir.js +++ b/test/simple/test-mkdir-rmdir.js @@ -1,7 +1,7 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var dirname = path.dirname(__filename); -var fixtures = path.join(dirname, "fixtures"); +var fixtures = path.join(dirname, "../fixtures"); var d = path.join(fixtures, "dir"); var mkdir_error = false; diff --git a/test/mjsunit/test-module-loading.js b/test/simple/test-module-loading.js similarity index 74% rename from test/mjsunit/test-module-loading.js rename to test/simple/test-module-loading.js index 8058cb2e77..0c453b6d72 100644 --- a/test/mjsunit/test-module-loading.js +++ b/test/simple/test-module-loading.js @@ -1,15 +1,15 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); debug("load test-module-loading.js"); -var a = require("./fixtures/a"); -var c = require("./fixtures/b/c"); -var d = require("./fixtures/b/d"); -var d2 = require("./fixtures/b/d"); +var a = require("../fixtures/a"); +var c = require("../fixtures/b/c"); +var d = require("../fixtures/b/d"); +var d2 = require("../fixtures/b/d"); // Absolute -var d3 = require(__dirname+"/fixtures/b/d"); +var d3 = require(path.join(__dirname, "../fixtures/b/d")); // Relative -var d4 = require("../mjsunit/fixtures/b/d"); +var d4 = require("../fixtures/b/d"); 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); debug("test index.js modules ids and relative loading") -var one = require("./fixtures/nested-index/one"), - two = require("./fixtures/nested-index/two"); +var one = require("../fixtures/nested-index/one"), + two = require("../fixtures/nested-index/two"); assert.notEqual(one.hello, two.hello); debug("test cycles containing a .. path"); -var root = require("./fixtures/cycles/root"), - foo = require("./fixtures/cycles/folder/foo"); +var root = require("../fixtures/cycles/root"), + foo = require("../fixtures/cycles/folder/foo"); assert.equal(root.foo, foo); assert.equal(root.sayHello(), root.hello); var errorThrown = false; try { - require("./fixtures/throws_error"); + require("../fixtures/throws_error"); } catch (e) { errorThrown = true; assert.equal("blah", e.message); @@ -57,7 +57,7 @@ try { 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; assert.equal("A", a.A()); }); diff --git a/test/mjsunit/test-next-tick.js b/test/simple/test-next-tick.js similarity index 91% rename from test/mjsunit/test-next-tick.js rename to test/simple/test-next-tick.js index 1dd20574ad..9758535320 100644 --- a/test/mjsunit/test-next-tick.js +++ b/test/simple/test-next-tick.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var complete = 0; diff --git a/test/mjsunit/test-path.js b/test/simple/test-path.js similarity index 91% rename from test/mjsunit/test-path.js rename to test/simple/test-path.js index 42c6559769..961d6d1fa2 100644 --- a/test/mjsunit/test-path.js +++ b/test/simple/test-path.js @@ -1,12 +1,12 @@ var path = require("path"); -process.mixin(require("./common")); +process.mixin(require("../common")); var f = __filename; assert.equal(path.basename(f), "test-path.js"); assert.equal(path.basename(f, ".js"), "test-path"); 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) }); assert.equal(path.join(".", "fixtures/b", "..", "/b/c.js"), "fixtures/b/c.js"); diff --git a/test/mjsunit/test-process-buffering.js b/test/simple/test-process-buffering.js similarity index 94% rename from test/mjsunit/test-process-buffering.js rename to test/simple/test-process-buffering.js index 6c16c9bf61..50d6ae622c 100644 --- a/test/mjsunit/test-process-buffering.js +++ b/test/simple/test-process-buffering.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var pwd_called = false; diff --git a/test/mjsunit/test-process-kill.js b/test/simple/test-process-kill.js similarity index 91% rename from test/mjsunit/test-process-kill.js rename to test/simple/test-process-kill.js index 8d642f7e70..9d2bf091f1 100644 --- a/test/mjsunit/test-process-kill.js +++ b/test/simple/test-process-kill.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var exit_status = -1; diff --git a/test/mjsunit/test-process-mixin.js b/test/simple/test-process-mixin.js similarity index 96% rename from test/mjsunit/test-process-mixin.js rename to test/simple/test-process-mixin.js index cf5fe6c7f4..18d21f53ef 100644 --- a/test/mjsunit/test-process-mixin.js +++ b/test/simple/test-process-mixin.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var target = function() {}; process.mixin(target, { diff --git a/test/mjsunit/test-process-simple.js b/test/simple/test-process-simple.js similarity index 95% rename from test/mjsunit/test-process-simple.js rename to test/simple/test-process-simple.js index a4e58f1369..ab6f87a21a 100644 --- a/test/mjsunit/test-process-simple.js +++ b/test/simple/test-process-simple.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var cat = process.createChildProcess("cat"); diff --git a/test/mjsunit/test-querystring.js b/test/simple/test-querystring.js similarity index 99% rename from test/mjsunit/test-querystring.js rename to test/simple/test-querystring.js index 19f7ee3902..58a70fe0c4 100644 --- a/test/mjsunit/test-querystring.js +++ b/test/simple/test-querystring.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); // test using assert diff --git a/test/mjsunit/test-readdir.js b/test/simple/test-readdir.js similarity index 95% rename from test/mjsunit/test-readdir.js rename to test/simple/test-readdir.js index 4ded485571..0838a980c1 100644 --- a/test/mjsunit/test-readdir.js +++ b/test/simple/test-readdir.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var got_error = false; diff --git a/test/mjsunit/test-remote-module-loading.js b/test/simple/test-remote-module-loading.js similarity index 96% rename from test/mjsunit/test-remote-module-loading.js rename to test/simple/test-remote-module-loading.js index 98179086a4..350e78ea9e 100644 --- a/test/mjsunit/test-remote-module-loading.js +++ b/test/simple/test-remote-module-loading.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var PORT = 8889; var http = require('http'); diff --git a/test/mjsunit/test-signal-handler.js b/test/simple/test-signal-handler.js similarity index 93% rename from test/mjsunit/test-signal-handler.js rename to test/simple/test-signal-handler.js index 5348bdd27d..a2d76e651a 100644 --- a/test/mjsunit/test-signal-handler.js +++ b/test/simple/test-signal-handler.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); puts("process.pid: " + process.pid); diff --git a/test/mjsunit/test-stdio.js b/test/simple/test-stdio.js similarity index 95% rename from test/mjsunit/test-stdio.js rename to test/simple/test-stdio.js index 786e9e187a..e30378c868 100644 --- a/test/mjsunit/test-stdio.js +++ b/test/simple/test-stdio.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var sub = path.join(fixturesDir, 'echo.js'); diff --git a/test/mjsunit/test-stdout-flush.js b/test/simple/test-stdout-flush.js similarity index 92% rename from test/mjsunit/test-stdout-flush.js rename to test/simple/test-stdout-flush.js index 58c945bea9..38f61d9084 100644 --- a/test/mjsunit/test-stdout-flush.js +++ b/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'); diff --git a/test/simple/test-sync-fileread.js b/test/simple/test-sync-fileread.js new file mode 100644 index 0000000000..adbe2e84a6 --- /dev/null +++ b/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)); diff --git a/test/mjsunit/test-sys.js b/test/simple/test-sys.js similarity index 98% rename from test/mjsunit/test-sys.js rename to test/simple/test-sys.js index 648452b0da..bff7d2704b 100644 --- a/test/mjsunit/test-sys.js +++ b/test/simple/test-sys.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); process.mixin(require("sys")); assert.equal("0", inspect(0)); diff --git a/test/mjsunit/test-tcp-binary.js b/test/simple/test-tcp-binary.js similarity index 97% rename from test/mjsunit/test-tcp-binary.js rename to test/simple/test-tcp-binary.js index 1bdc33ad66..fb2b8b4f2b 100644 --- a/test/mjsunit/test-tcp-binary.js +++ b/test/simple/test-tcp-binary.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); PORT = 23123; diff --git a/test/mjsunit/test-tcp-reconnect.js b/test/simple/test-tcp-reconnect.js similarity index 96% rename from test/mjsunit/test-tcp-reconnect.js rename to test/simple/test-tcp-reconnect.js index 4bf4ed8945..65563b644b 100644 --- a/test/mjsunit/test-tcp-reconnect.js +++ b/test/simple/test-tcp-reconnect.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); tcp = require("tcp"); var N = 50; var port = 8921; diff --git a/test/mjsunit/test-umask.js b/test/simple/test-umask.js similarity index 72% rename from test/mjsunit/test-umask.js rename to test/simple/test-umask.js index 0309a8eadd..5509cd132c 100644 --- a/test/mjsunit/test-umask.js +++ b/test/simple/test-umask.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var mask = 0664; var old = process.umask(mask); diff --git a/test/mjsunit/test-url.js b/test/simple/test-url.js similarity index 99% rename from test/mjsunit/test-url.js rename to test/simple/test-url.js index 1ec6b7100f..b474812d87 100644 --- a/test/mjsunit/test-url.js +++ b/test/simple/test-url.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); var url = require("url"), sys = require("sys"); diff --git a/test/mjsunit/test-utf8-scripts.js b/test/simple/test-utf8-scripts.js similarity index 78% rename from test/mjsunit/test-utf8-scripts.js rename to test/simple/test-utf8-scripts.js index a8f2e96332..8346d43fac 100644 --- a/test/mjsunit/test-utf8-scripts.js +++ b/test/simple/test-utf8-scripts.js @@ -1,4 +1,4 @@ -process.mixin(require("./common")); +process.mixin(require("../common")); // üäö diff --git a/test/simple/testcfg.py b/test/simple/testcfg.py new file mode 100644 index 0000000000..7d730edebd --- /dev/null +++ b/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) diff --git a/tools/test.py b/tools/test.py index 74bde14abf..e89578f26c 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1195,7 +1195,7 @@ def GetSpecialCommandProcessor(value): return ExpandCommand -BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message'] +BUILT_IN_TESTS = ['simple', 'pummel', 'internet'] def GetSuites(test_root):