Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faster CIs #13803

Merged
merged 46 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
13b5eb5
ttables: smaller table, 5x speedup
narimiran Mar 24, 2020
14704b1
thavlak: less iterations, less loops; 30% speedup
narimiran Mar 24, 2020
7dfc8c7
tasyncclosestall: shorter timeout; 35% speedup
narimiran Mar 24, 2020
20ae86f
gcleak4: less iterations, 2x speedup
narimiran Mar 24, 2020
ba249db
ttimes: remove deprecated stuff
narimiran Mar 24, 2020
9181c84
tdangerisrelease: remove cpp backend, 3x speedup
narimiran Mar 24, 2020
0158da4
tfrexp1: smaller range, 2x speedup
narimiran Mar 24, 2020
e487722
trtree: fix warnings, less iterations, 6x speedup
narimiran Mar 24, 2020
f26c66e
tasyncawait_cyclebreaker: smaller swarm size; 2x speedup
narimiran Mar 24, 2020
e147a96
trealloc: smaller number of iterations; 10x speedup
narimiran Mar 24, 2020
e373459
towned_binary_tree: less iterations, 4x speedup
narimiran Mar 24, 2020
e65ecc1
tclosure: remove unused code, less iterations; 2x speedup
narimiran Mar 24, 2020
3771d34
twaitany: less durations; 1.4x speedup
narimiran Mar 24, 2020
8467491
tasync_misc: less iterations, 2x speedup
narimiran Mar 24, 2020
b4cf51f
t8535: smaller sleep, 1.5x speedup
narimiran Mar 24, 2020
6b9fbbf
tmanyjoin: smaller sleep, 2x speedup
narimiran Mar 24, 2020
df5bfaf
t12221: shorter sleeps, removed two slower tests; 1.6x speedup
narimiran Mar 24, 2020
cb52259
tfuturestream: smaller sleep; 1.5x speedup
narimiran Mar 24, 2020
7c348f3
growobjcrash: less iterations; 2x speedup
narimiran Mar 24, 2020
9b54ea8
ttryrecv: smaller sleep; 1.5x speedup
narimiran Mar 24, 2020
3ad1343
treusetvar: less threads; 2x speedup
narimiran Mar 24, 2020
059333f
delete tthreadanalysis2, basically a duplicate of tthreadanalysis
narimiran Mar 24, 2020
cab3873
t7758: less iterations, 1.5x speedup
narimiran Mar 24, 2020
bc4856b
tasyncawait: smaller swarm, less messages; 1.5x speedup
narimiran Mar 24, 2020
bb9d348
tjsandnativeasync: smaller sleep, 1.5x speedup
narimiran Mar 24, 2020
889362a
tpendingcheck: smaller sleep, 1.5x speedup
narimiran Mar 24, 2020
f7a237c
remove rodfiles test category
narimiran Mar 25, 2020
b6f3600
move tseq from its own category to 'collections' category
narimiran Mar 25, 2020
b1a9231
remove unneeded tests and helpers from 'assert' category
narimiran Mar 25, 2020
71a9f83
stdlib: merge tbitops2 into tbitops
narimiran Mar 25, 2020
9030c2c
remove 'trepr2' from 'stdlib' cat
narimiran Mar 25, 2020
314799c
merge 'tstreams' into one file
narimiran Mar 25, 2020
ed273f5
remove 'tinefficient_const_table' from 'ccbugs' cat
narimiran Mar 25, 2020
739ba42
merge 'tcollections_to_string' into 'tcollections'
narimiran Mar 25, 2020
f42f6c0
tblocking_channel: smaller sleep, small speedup
narimiran Mar 25, 2020
40e670f
tconvexhull: less iterartions; 1.2x speedup
narimiran Mar 25, 2020
ecb737a
merge 'tdeepcopy2' into 'tdeepcopy'
narimiran Mar 30, 2020
7e79e9d
merge 'tdisjoint_slice2' into 'tdisjoint_slice1'
narimiran Mar 25, 2020
5b5a250
tmissing_deepcopy: smaller sequence
narimiran Mar 25, 2020
47e9eca
tsendtwice: smaller arrays; 5x speedup
narimiran Mar 25, 2020
a60cc28
remove 'tindexerrorformatbounds'
narimiran Mar 25, 2020
b96f74e
disable multimethod tests
narimiran Mar 25, 2020
226098c
testament: no need for 8 sub-second decimals
narimiran Mar 27, 2020
e8b507a
remove 'gc:none' and 'refc' without 'd:useRealtimeGC' from gc tests
narimiran Mar 26, 2020
9593cd9
koch.nim: bootstrap just with '-d:release', no need for 'csource'
narimiran Mar 26, 2020
fcca062
add github workflow for documentation
narimiran Mar 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Nim Docs CI
on:
pull_request:
# Run only on changes on these files
paths:
- 'lib/*.nim'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed in #13809

- 'doc/*.rst'

jobs:
build:
name: 'Docs builder'
runs-on: ubuntu-18.04
steps:
- name: 'Checkout'
uses: actions/checkout@v2

- name: 'Checkout csources'
uses: actions/checkout@v2
with:
repository: nim-lang/csources
path: csources

- name: 'Add build binaries to PATH'
shell: bash
run: echo "::add-path::${{ github.workspace }}/bin"

- name: 'Build 1-stage compiler from csources'
shell: bash
run: |
ncpu=$(nproc)
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1

make -C csources -j $ncpu CC=gcc ucpu='amd64'

- name: 'Build koch'
shell: bash
run: nim c koch

- name: 'Build the real compiler'
shell: bash
run: ./koch boot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not ./koch boot -d:release ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can/should be changed in #13809, @alaviss.


- name: 'Build documentation'
shell: bash
run: ./koch doc
17 changes: 2 additions & 15 deletions koch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,6 @@ proc runCI(cmd: string) =
doAssert cmd.len == 0, cmd # avoid silently ignoring
echo "runCI: ", cmd
echo hostInfo()
# note(@araq): Do not replace these commands with direct calls (eg boot())
# as that would weaken our testing efforts.
when defined(posix): # appveyor (on windows) didn't run this
kochExecFold("Boot", "boot")
# boot without -d:nimHasLibFFI to make sure this still works
kochExecFold("Boot in release mode", "boot -d:release")

Expand All @@ -494,7 +490,7 @@ proc runCI(cmd: string) =
if getEnv("NIM_TEST_PACKAGES", "false") == "true":
execFold("Test selected Nimble packages", "nim c -r testament/testament cat nimble-packages")
else:
buildTools() # altenatively, kochExec "tools --toolsNoNimble"
buildTools()

## run tests
execFold("Test nimscript", "nim e tests/test_nimscript.nims")
Expand All @@ -504,7 +500,7 @@ proc runCI(cmd: string) =

# main bottleneck here
execFold("Run tester", "nim c -r -d:nimCoroutines testament/testament --pedantic all -d:nimCoroutines")
block: # CT FFI
block CT_FFI:
when defined(posix): # windows can be handled in future PR's
execFold("nimble install -y libffi", "nimble install -y libffi")
const nimFFI = "./bin/nim.ctffi"
Expand All @@ -517,15 +513,6 @@ proc runCI(cmd: string) =
when defined(posix):
execFold("Run nimsuggest tests", "nim c -r nimsuggest/tester")

## remaining actions
when defined(posix):
kochExecFold("Docs", "docs --git.commit:devel")
kochExecFold("C sources", "csource")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure nightlies doesn't rely on this command?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightlies don't use koch runCI. They run nightlies.sh.

elif defined(windows):
when false:
kochExec "csource"
kochExec "zip"

proc pushCsources() =
if not dirExists("../csources/.git"):
quit "[Error] no csources git repository found"
Expand Down
10 changes: 1 addition & 9 deletions testament/categories.nim
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,8 @@ proc dllTests(r: var TResults, cat: Category, options: string) =
# ------------------------------ GC tests -------------------------------------

proc gcTests(r: var TResults, cat: Category, options: string) =
template testWithNone(filename: untyped) =
testSpec r, makeTest("tests/gc" / filename, options &
" --gc:none", cat)
testSpec r, makeTest("tests/gc" / filename, options &
" -d:release --gc:none", cat)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--gc:none is now not being tested at all here despite what the commit msg remove 'gc:none' and 'refc' without 'd:useRealtimeGC' from gc tests seems to imply

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i misread your commit message but regardless, after your PR, --gc:none is not being tested anymore. Is that becaus --gc:arc is to replace it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--gc:arc is replacing it an also because --gc:none tests are hardly ever broken. Chance for regressions is minor.


template testWithoutMs(filename: untyped) =
testSpec r, makeTest("tests/gc" / filename, options, cat)
testSpec r, makeTest("tests/gc" / filename, options &
" -d:release", cat)
testSpec r, makeTest("tests/gc" / filename, options &
" -d:release -d:useRealtimeGC", cat)
when filename != "gctest":
Expand All @@ -193,6 +185,7 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
" --gc:markAndSweep", cat)
testSpec r, makeTest("tests/gc" / filename, options &
" -d:release --gc:markAndSweep", cat)

template test(filename: untyped) =
testWithoutBoehm filename
when not defined(windows) and not defined(android):
Expand All @@ -210,7 +203,6 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
test "gcleak"
test "gcleak2"
testWithoutBoehm "gctest"
testWithNone "gctest"
test "gcleak3"
test "gcleak4"
# Disabled because it works and takes too long to run:
Expand Down
4 changes: 2 additions & 2 deletions testament/testament.nim
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
let success = if test.spec.timeout > 0.0 and duration > test.spec.timeout: reTimeout
else: successOrig

let durationStr = duration.formatFloat(ffDecimal, precision = 8).align(11)
let durationStr = duration.formatFloat(ffDecimal, precision = 2).align(5)
if backendLogging:
backend.writeTestResult(name = name,
category = test.cat.string,
Expand All @@ -271,7 +271,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
given = given)
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
if success == reSuccess:
maybeStyledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " secs)"
maybeStyledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " sec)"
elif success == reDisabled:
maybeStyledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name
elif success == reJoined:
Expand Down
44 changes: 14 additions & 30 deletions tests/assert/tassert2.nim
Original file line number Diff line number Diff line change
@@ -1,59 +1,44 @@
discard """
output: '''
test1:ok
test2:ok
test3:ok
test4:ok
test5:ok
test6:ok
test7:ok
`false` first assertion from bar
`false` second assertion from bar
-1
tassert2.nim
test8:ok
test9:ok
test10:ok
test11:ok
'''
"""
import testhelper
from strutils import endsWith

type
TLineInfo = tuple[filename: string, line: int, column: int]
TMyError = object of Exception
lineinfo: TLineInfo
EMyError = ref TMyError

echo("")

# NOTE: when entering newlines, adjust `expectedEnd` outputs

try:
doAssert(false, "msg1") # doAssert test
except AssertionError as e:
checkMsg(e.msg, "tassert2.nim(30, 11) `false` msg1", "test1")

try:
assert false, "msg2" # assert test
except AssertionError as e:
checkMsg(e.msg, "tassert2.nim(35, 10) `false` msg2", "test2")
assert e.msg.endsWith "tassert2.nim(20, 11) `false` msg1"

try:
assert false # assert test with no msg
except AssertionError as e:
checkMsg(e.msg, "tassert2.nim(40, 10) `false` ", "test3")
assert e.msg.endsWith "tassert2.nim(25, 10) `false` "

try:
let a = 1
doAssert(a+a==1) # assert test with Ast expression
# BUG: const folding would make "1+1==1" appear as `false` in
# assert message
except AssertionError as e:
checkMsg(e.msg, "`a + a == 1` ", "test4")
assert e.msg.endsWith "`a + a == 1` "

try:
let a = 1
doAssert a+a==1 # ditto with `doAssert` and no parens
except AssertionError as e:
checkMsg(e.msg, "`a + a == 1` ", "test5")
assert e.msg.endsWith "`a + a == 1` "

proc fooStatic() =
# protect against https://github.com/nim-lang/Nim/issues/8758
Expand All @@ -80,12 +65,12 @@ block:
proc bar: int =
# local overrides that are active only in this proc
onFailedAssert(msg):
checkMsg(msg, "tassert2.nim(85, 11) `false` first assertion from bar", "test6")
echo msg[^32..^1]

assert(false, "first assertion from bar")

onFailedAssert(msg):
checkMsg(msg, "tassert2.nim(91, 11) `false` second assertion from bar", "test7")
echo msg[^33..^1]
return -1

assert(false, "second assertion from bar")
Expand All @@ -97,8 +82,7 @@ block:
foo()
except:
let e = EMyError(getCurrentException())
echo e.lineinfo.filename
checkMsg(e.msg, "tassert2.nim(77, 11) `false` assertion from foo", "test8")
assert e.msg.endsWith "tassert2.nim(62, 11) `false` assertion from foo"

block: ## checks for issue https://github.com/nim-lang/Nim/issues/8518
template fun(a: string): string =
Expand All @@ -109,19 +93,19 @@ block: ## checks for issue https://github.com/nim-lang/Nim/issues/8518
doAssert fun("foo1") == fun("foo2"), "mymsg"
except AssertionError as e:
# used to expand out the template instantiaiton, sometimes filling hundreds of lines
checkMsg(e.msg, """tassert2.nim(109, 14) `fun("foo1") == fun("foo2")` mymsg""", "test9")
assert e.msg.endsWith ""

block: ## checks for issue https://github.com/nim-lang/Nim/issues/9301
try:
doAssert 1 + 1 == 3
except AssertionError as e:
# used to const fold as false
checkMsg(e.msg, "tassert2.nim(116, 14) `1 + 1 == 3` ", "test10")
assert e.msg.endsWith "tassert2.nim(100, 14) `1 + 1 == 3` "

block: ## checks AST isn't transformed as it used to
let a = 1
try:
doAssert a > 1
except AssertionError as e:
# used to rewrite as `1 < a`
checkMsg(e.msg, "tassert2.nim(124, 14) `a > 1` ", "test11")
assert e.msg.endsWith "tassert2.nim(108, 14) `a > 1` "
20 changes: 0 additions & 20 deletions tests/assert/tdoassert.nim

This file was deleted.

12 changes: 0 additions & 12 deletions tests/assert/testhelper.nim

This file was deleted.

11 changes: 0 additions & 11 deletions tests/assert/trelativeassert.nim

This file was deleted.

30 changes: 9 additions & 21 deletions tests/async/t12221.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncdispatch, os, times

proc doubleSleep(hardSleep: int) {.async.} =
await sleepAsync(100)
await sleepAsync(50)
sleep(hardSleep)

template assertTime(target, timeTook: float): untyped {.dirty.} =
Expand All @@ -16,37 +16,25 @@ var

# NOTE: this uses poll(3000) to limit timing error potential.
start = epochTime()
fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(40)
fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(20)
while not fut.finished:
poll(3000)
poll(1000)
assertTime(150, epochTime() - start)

start = epochTime()
fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(100)
fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(50)
while not fut.finished:
poll(3000)
poll(1000)
assertTime(200, epochTime() - start)

start = epochTime()
fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(40) and sleepAsync(300)
fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(20) and sleepAsync(200)
while not fut.finished:
poll(3000)
poll(1000)
assertTime(300, epochTime() - start)

start = epochTime()
fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(100) and sleepAsync(300)
fut = (sleepAsync(40) and sleepAsync(100) and doubleSleep(20)) or sleepAsync(300)
while not fut.finished:
poll(3000)
assertTime(300, epochTime() - start)

start = epochTime()
fut = (sleepAsync(50) and sleepAsync(150) and doubleSleep(40)) or sleepAsync(700)
while not fut.finished:
poll(3000)
poll(1000)
assertTime(150, epochTime() - start)

start = epochTime()
fut = (sleepAsync(50) and sleepAsync(150) and doubleSleep(100)) or sleepAsync(700)
while not fut.finished:
poll(3000)
assertTime(200, epochTime() - start)
2 changes: 1 addition & 1 deletion tests/async/t7758.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ proc main() =

doAssert counter <= 4

for i in 0 .. 10: main()
for i in 0 .. 4: main()
4 changes: 2 additions & 2 deletions tests/async/tasync_misc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ block: #6100
done.complete(1)

proc asyncSum: Future[int] {.async.} =
for _ in 1..10_000_000:
for _ in 1..1_000_000:
result += await done

let res = waitFor asyncSum()
doAssert(res == 10000000)
doAssert(res == 1_000_000)

block: #7985
proc getData(): Future[JsonNode] {.async.} =
Expand Down
6 changes: 3 additions & 3 deletions tests/async/tasyncawait.nim
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
discard """
output: "5000"
output: "2000"
"""
import asyncdispatch, asyncnet, nativesockets, net, strutils, os

var msgCount = 0

const
swarmSize = 50
messagesToSend = 100
swarmSize = 40
messagesToSend = 50

var clientCount = 0

Expand Down
Loading