diff options
author | Jacek Sieka <arnetheduck@gmail.com> | 2018-10-12 09:27:47 -0600 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-12 17:27:47 +0200 |
commit | 97738a4f2842c88b7b63a579565cd860a7b28c4e (patch) | |
tree | 32c32ac85b9e91e7ba37684002c2054e28a1d269 | |
parent | c492a7fd839175244abb7d4b40d189ec10d53aed (diff) | |
download | Nim-97738a4f2842c88b7b63a579565cd860a7b28c4e.tar.gz |
Testament pre parallel (#9137)
* testament: move to root dir (it's not a test) * osproc: fix process index passed to afterRunEvent for parallel runs it was passing the index of the process, not index of all commands * testament: complete file move
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | appveyor.yml | 6 | ||||
-rw-r--r-- | ci/nsis_build.bat | 2 | ||||
-rw-r--r-- | doc/contributing.rst | 2 | ||||
-rw-r--r-- | doc/koch.rst | 2 | ||||
-rw-r--r-- | koch.nim | 4 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 5 | ||||
-rw-r--r-- | testament/backend.nim (renamed from tests/testament/backend.nim) | 0 | ||||
-rw-r--r-- | testament/caasdriver.nim (renamed from tests/testament/caasdriver.nim) | 0 | ||||
-rw-r--r-- | testament/categories.nim (renamed from tests/testament/categories.nim) | 0 | ||||
-rw-r--r-- | testament/htmlgen.nim (renamed from tests/testament/htmlgen.nim) | 0 | ||||
-rw-r--r-- | testament/specs.nim (renamed from tests/testament/specs.nim) | 0 | ||||
-rw-r--r-- | testament/testamenthtml.templ (renamed from tests/testament/testamenthtml.templ) | 0 | ||||
-rw-r--r-- | testament/tester.nim (renamed from tests/testament/tester.nim) | 4 | ||||
-rw-r--r-- | testament/tester.nim.cfg (renamed from tests/testament/tester.nim.cfg) | 0 | ||||
-rw-r--r-- | tests/readme.md | 2 | ||||
-rw-r--r-- | tests/stdlib/tnre.nim | 2 |
18 files changed, 20 insertions, 17 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c37b4c8d4..70ff59136 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,8 +53,8 @@ test-windows: <<: *win_set_path_def script: - call ci\deps.bat - - nim c --taintMode:on tests\testament\tester - - tests\testament\tester.exe --pedantic all + - nim c --taintMode:on testament\tester + - testament\tester.exe --pedantic all tags: - windows - fast diff --git a/.travis.yml b/.travis.yml index 042ab731c..98ac61d16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,8 +42,8 @@ script: #- nimble install sdl1 #- nimble install jester@#head -y #- nimble install niminst - - nim c --taintMode:on -d:nimCoroutines tests/testament/tester - - tests/testament/tester --pedantic all -d:nimCoroutines + - nim c --taintMode:on -d:nimCoroutines testament/tester + - testament/tester --pedantic all -d:nimCoroutines - nim c -o:bin/nimpretty nimpretty/nimpretty.nim - nim c -r nimpretty/tester.nim - ./koch docs --git.commit:devel diff --git a/appveyor.yml b/appveyor.yml index 46311fce2..a60831f9d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,11 +53,11 @@ build_script: # - nimble install opengl -y # - nimble install sdl1 -y # - nimble install jester@#head -y - - nim c --taintMode:on -d:nimCoroutines --os:genode -d:posix --compileOnly tests/testament/tester - - nim c --taintMode:on -d:nimCoroutines tests/testament/tester + - nim c --taintMode:on -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester + - nim c --taintMode:on -d:nimCoroutines testament/tester test_script: - - tests\testament\tester --pedantic all -d:nimCoroutines + - testament\tester --pedantic all -d:nimCoroutines - nim c -r nimdoc\tester # - koch csource # - koch zip diff --git a/ci/nsis_build.bat b/ci/nsis_build.bat index 4e9d0d67c..4806810d7 100644 --- a/ci/nsis_build.bat +++ b/ci/nsis_build.bat @@ -1,4 +1,4 @@ -REM - Run the full testsuite; tests\testament\tester all +REM - Run the full testsuite; testament\tester all REM - Uncomment the list of changes in news.txt REM - write a news ticker entry diff --git a/doc/contributing.rst b/doc/contributing.rst index 72c3ed807..c9dbc0d3f 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -109,7 +109,7 @@ only want to see the output of failing tests, go for You can also run only a single category of tests. A category is a subdirectory in the ``tests`` directory. There are a couple of special categories; for a -list of these, see ``tests/testament/categories.nim``, at the bottom. +list of these, see ``testament/categories.nim``, at the bottom. :: diff --git a/doc/koch.rst b/doc/koch.rst index 35cf9d8b6..2140a05f2 100644 --- a/doc/koch.rst +++ b/doc/koch.rst @@ -61,7 +61,7 @@ test command ------------ The `test`:idx: command can also be invoked with the alias ``tests``. This -command will compile and run ``tests/testament/tester.nim``, which is the main +command will compile and run ``testament/tester.nim``, which is the main driver of Nim's test suite. You can pass options to the ``test`` command, they will be forwarded to the tester. See its source code for available options. diff --git a/koch.nim b/koch.nim index 6ff6ab875..c6f28f870 100644 --- a/koch.nim +++ b/koch.nim @@ -380,11 +380,11 @@ template `|`(a, b): string = (if a.len > 0: a else: b) proc tests(args: string) = # we compile the tester with taintMode:on to have a basic # taint mode test :-) - nimexec "cc --taintMode:on --opt:speed tests/testament/tester" + nimexec "cc --taintMode:on --opt:speed testament/tester" # Since tests take a long time (on my machine), and we want to defy Murhpys # law - lets make sure the compiler really is freshly compiled! nimexec "c --lib:lib -d:release --opt:speed compiler/nim.nim" - let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe) + let tester = quoteShell(getCurrentDir() / "testament/tester".exe) let success = tryExec tester & " " & (args|"all") if not existsEnv("TRAVIS") and not existsEnv("APPVEYOR"): exec tester & " html" diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index d7b734dda..e487a8975 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -236,6 +236,7 @@ proc execProcesses*(cmds: openArray[string], if n > 1: var i = 0 var q = newSeq[Process](n) + var idxs = newSeq[int](n) # map process index to cmds index when defined(windows): var w: WOHandleArray @@ -248,6 +249,7 @@ proc execProcesses*(cmds: openArray[string], if beforeRunEvent != nil: beforeRunEvent(i) q[i] = startProcess(cmds[i], options = options + {poEvalCommand}) + idxs[i] = i when defined(windows): w[i] = q[i].fProcessHandle inc(i) @@ -304,12 +306,13 @@ proc execProcesses*(cmds: openArray[string], if rexit >= 0: result = max(result, abs(q[rexit].peekExitCode())) - if afterRunEvent != nil: afterRunEvent(rexit, q[rexit]) + if afterRunEvent != nil: afterRunEvent(idxs[rexit], q[rexit]) close(q[rexit]) if i < len(cmds): if beforeRunEvent != nil: beforeRunEvent(i) q[rexit] = startProcess(cmds[i], options = options + {poEvalCommand}) + idxs[rexit] = i when defined(windows): w[rexit] = q[rexit].fProcessHandle inc(i) diff --git a/tests/testament/backend.nim b/testament/backend.nim index 385f1171c..385f1171c 100644 --- a/tests/testament/backend.nim +++ b/testament/backend.nim diff --git a/tests/testament/caasdriver.nim b/testament/caasdriver.nim index 30383bddb..30383bddb 100644 --- a/tests/testament/caasdriver.nim +++ b/testament/caasdriver.nim diff --git a/tests/testament/categories.nim b/testament/categories.nim index 59ce70315..59ce70315 100644 --- a/tests/testament/categories.nim +++ b/testament/categories.nim diff --git a/tests/testament/htmlgen.nim b/testament/htmlgen.nim index 4a10fe00c..4a10fe00c 100644 --- a/tests/testament/htmlgen.nim +++ b/testament/htmlgen.nim diff --git a/tests/testament/specs.nim b/testament/specs.nim index c51a3343e..c51a3343e 100644 --- a/tests/testament/specs.nim +++ b/testament/specs.nim diff --git a/tests/testament/testamenthtml.templ b/testament/testamenthtml.templ index 9190f370e..9190f370e 100644 --- a/tests/testament/testamenthtml.templ +++ b/testament/testamenthtml.templ diff --git a/tests/testament/tester.nim b/testament/tester.nim index 15f44f871..024d02ed4 100644 --- a/tests/testament/tester.nim +++ b/testament/tester.nim @@ -477,7 +477,7 @@ proc main() = case action of "all": let testsDir = "tests" & DirSep - var myself = quoteShell(findExe("tests" / "testament" / "tester")) + var myself = quoteShell(findExe("testament" / "tester")) if targetsStr.len > 0: myself &= " " & quoteShell("--targets:" & targetsStr) @@ -488,7 +488,7 @@ proc main() = for kind, dir in walkDir(testsDir): assert testsDir.startsWith(testsDir) let cat = dir[testsDir.len .. ^1] - if kind == pcDir and cat notin ["testament", "testdata", "nimcache"]: + if kind == pcDir and cat notin ["testdata", "nimcache"]: cmds.add(myself & " cat " & quoteShell(cat) & rest) for cat in AdditionalCategories: cmds.add(myself & " cat " & quoteShell(cat) & rest) diff --git a/tests/testament/tester.nim.cfg b/testament/tester.nim.cfg index 27fd67075..27fd67075 100644 --- a/tests/testament/tester.nim.cfg +++ b/testament/tester.nim.cfg diff --git a/tests/readme.md b/tests/readme.md index 34a2c4bfb..1ee93dbcb 100644 --- a/tests/readme.md +++ b/tests/readme.md @@ -10,7 +10,7 @@ execute the compiled binary, you need to specify a spec with an ``action`` key Each test can contain a spec in a ``discard """ ... """`` block. -**Check out the [``parseSpec`` procedure](https://github.com/nim-lang/Nim/blob/devel/tests/testament/specs.nim#L124) in the ``specs`` module for a full and reliable reference** +**Check out the [``parseSpec`` procedure](https://github.com/nim-lang/Nim/blob/devel/testament/specs.nim#L124) in the ``specs`` module for a full and reliable reference** ## action diff --git a/tests/stdlib/tnre.nim b/tests/stdlib/tnre.nim index fabbb69a8..0929956cb 100644 --- a/tests/stdlib/tnre.nim +++ b/tests/stdlib/tnre.nim @@ -1,6 +1,6 @@ discard """ # Since the tests for nre are all bundled together we treat failure in one test as an nre failure -# When running 'tests/testament/tester' a failed check() in the test suite will cause the exit +# When running 'testament/tester' a failed check() in the test suite will cause the exit # codes to differ and be reported as a failure output: |