summary refs log tree commit diff stats
path: root/tests
ModeNameSize
d---------actiontable44log stats plain
d---------alias38log stats plain
d---------align128log stats plain
d---------ambsym318log stats plain
d---------arc1918log stats plain
d---------arithm76log stats plain
d---------array397log stats plain
d---------assert244log stats plain
d---------assign177log stats plain
-rw-r--r--ast_pattern_matching.nim18808log stats plain blame
d---------astoverload45log stats plain
d---------astspec40log stats plain
d---------async2610log stats plain
d---------bind259log stats plain
d---------borrow85log stats plain
d---------casestmt417log stats plain
d---------ccgbugs3479log stats plain
d---------ccgbugs256log stats plain
d---------clearmsg199log stats plain
d---------closure769log stats plain
d---------cnstseq40log stats plain
d---------collections316log stats plain
d---------compilepragma70log stats plain
d---------compiler374log stats plain
d---------compilerapi162log stats plain
d---------compilerfeatures44log stats plain
d---------compiles185log stats plain
d---------concat39log stats plain
d---------concepts1427log stats plain
-rw-r--r--config.nims460log stats plain blame
d---------constr199log stats plain
d---------constraints44log stats plain
d---------constructors131log stats plain
d---------controlflow123log stats plain
d---------converter532log stats plain
d---------coroutines330log stats plain
d---------cpp1481log stats plain
d---------defaultprocparam98log stats plain
d---------deprecated202log stats plain
d---------deps148log stats plain
d---------destructor3202log stats plain
d---------dir with space76log stats plain
d---------discard232log stats plain
d---------distinct162log stats plain
d---------distros47log stats plain
d---------dll1075log stats plain
-rw-r--r--dummy.txt27log stats plain blame
d---------effects782log stats plain
d---------enum362log stats plain
d---------errmsgs2984log stats plain
d---------exception970log stats plain
d---------exprs266log stats plain
d---------fields85log stats plain
d---------flags42log stats plain
d---------float483log stats plain
d---------fragmentation127log stats plain
d---------friends80log stats plain
d---------gc862log stats plain
d---------generics2653log stats plain
d---------gensym85log stats plain
d---------global204log stats plain
d---------ic79log stats plain
d---------implicit41log stats plain
d---------import_in_config109log stats plain
d---------init159log stats plain
d---------isolate40log stats plain
d---------iter1600log stats plain
-rw-r--r--js.html765log stats plain blame
-rw-r--r--js.nim572log stats plain blame
d---------js2590log stats plain
d---------lent194log stats plain
d---------let191log stats plain
d---------lexer534log stats plain
d---------lookups169log stats plain
-rw-r--r--m14634.nim1573log stats plain blame
d---------macros2827log stats plain
d---------magics39log stats plain
d---------manyloc230log stats plain
d---------metatype1265log stats plain
d---------method512log stats plain
d---------misc4012log stats plain
-rw-r--r--mmaptest.nim1086log stats plain blame
d---------modules2234log stats plain
d---------namedparams134log stats plain
d---------newconfig111log stats plain
d---------nimble373log stats plain
d---------nimdoc189log stats plain
d---------niminaction245log stats plain
d---------notnil346log stats plain
d---------objects592log stats plain
d---------objvariant642log stats plain
d---------openarray245log stats plain
d---------osproc202log stats plain
d---------overflw120log stats plain
d---------overload670log stats plain
d---------package_level_objects164log stats plain
d---------parallel1269log stats plain
d---------parser1072log stats plain
d---------pragmas954log stats plain
d---------proc247log stats plain
d---------procvar88log stats plain
d---------range304log stats plain
d---------rational83log stats plain
-rw-r--r--readme.md1822log stats plain blame
d---------realtimeGC230log stats plain
-rw-r--r--rectest.nim57log stats plain blame
d---------semreject56log stats plain
d---------sets119log stats plain
d---------showoff286log stats plain
d---------specialops39log stats plain
d---------statictypes352log stats plain
-rw-r--r--stckovfl.nim141log stats plain blame
d---------stdlib4415log stats plain
d---------system743log stats plain
d---------template1578log stats plain
-rw-r--r--test_nimscript.nims2002log stats plain blame
d---------testament48log stats plain
d---------testdata401log stats plain
d---------threads474log stats plain
d---------tools221log stats plain
d---------trmacros216log stats plain
d---------tuples468log stats plain
d---------typerel1889log stats plain
d---------types1622log stats plain
d---------untestable342log stats plain
d---------usingstmt84log stats plain
d---------valgrind47log stats plain
d---------varres456log stats plain
d---------varstmt76log stats plain
d---------views343log stats plain
d---------vm3194log stats plain
t, finalDest) when not defined(windows): echo "[Warning] executables are still not equal" # -------------- clean -------------------------------------------------------- const cleanExt = [ ".ppu", ".o", ".obj", ".dcu", ".~pas", ".~inc", ".~dsk", ".~dpr", ".map", ".tds", ".err", ".bak", ".pyc", ".exe", ".rod", ".pdb", ".idb", ".idx", ".ilk" ] ignore = [ ".bzrignore", "nim", "nim.exe", "koch", "koch.exe", ".gitignore" ] proc cleanAux(dir: string) = for kind, path in walkDir(dir): case kind of pcFile: var (_, name, ext) = splitFile(path) if ext == "" or cleanExt.contains(ext): if not ignore.contains(name): echo "removing: ", path removeFile(path) of pcDir: case splitPath(path).tail of "nimcache": echo "removing dir: ", path removeDir(path) of "dist", ".git", "icons": discard else: cleanAux(path) else: discard proc removePattern(pattern: string) = for f in walkFiles(pattern): echo "removing: ", f removeFile(f) proc clean(args: string) = removePattern("web/*.html") removePattern("doc/*.html") cleanAux(getCurrentDir()) for kind, path in walkDir(getCurrentDir() / "build"): if kind == pcDir: echo "removing dir: ", path removeDir(path) # -------------- builds a release --------------------------------------------- proc winReleaseArch(arch: string) = doAssert arch in ["32", "64"] let cpu = if arch == "32": "i386" else: "amd64" template withMingw(path, body) = let prevPath = getEnv("PATH") putEnv("PATH", (if path.len > 0: path & PathSep else: "") & prevPath) try: body finally: putEnv("PATH", prevPath) withMingw r"..\mingw" & arch & r"\bin": # Rebuilding koch is necessary because it uses its pointer size to # determine which mingw link to put in the NSIS installer. nimexec "c --cpu:$# koch" % cpu exec "koch boot -d:release --cpu:$#" % cpu exec "koch --latest zip -d:release" overwriteFile r"build\nim-$#.zip" % VersionAsString, r"web\upload\download\nim-$#_x$#.zip" % [VersionAsString, arch] proc winRelease*() = # Now used from "tools/winrelease" and not directly supported by koch # anymore! # Build -docs file: when true: buildDocs(gaCode) withDir "web/upload/" & VersionAsString: exec "7z a -tzip docs-$#.zip *.html" % VersionAsString overwriteFile "web/upload/$1/docs-$1.zip" % VersionAsString, "web/upload/download/docs-$1.zip" % VersionAsString when true: csource("-d:release") when sizeof(pointer) == 4: winReleaseArch "32" when sizeof(pointer) == 8: winReleaseArch "64" # -------------- tests -------------------------------------------------------- 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" # 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 success = tryExec tester & " " & (args|"all") if not existsEnv("TRAVIS") and not existsEnv("APPVEYOR"): exec tester & " html" if not success: quit("tests failed", QuitFailure) proc temp(args: string) = proc splitArgs(a: string): (string, string) = # every --options before the command (indicated by starting # with not a dash) is part of the bootArgs, the rest is part # of the programArgs: let args = os.parseCmdLine a result = ("", "") var i = 0 while i < args.len and args[i][0] == '-': result[0].add " " & quoteShell(args[i]) inc i while i < args.len: result[1].add " " & quoteShell(args[i]) inc i var output = "compiler" / "nim".exe var finalDest = "bin" / "nim_temp".exe # 125 is the magic number to tell git bisect to skip the current # commit. let (bootArgs, programArgs) = splitArgs(args) let nimexec = findNim() exec(nimexec & " c -d:debug --debugger:native " & bootArgs & " compiler" / "nim", 125) copyExe(output, finalDest) if programArgs.len > 0: exec(finalDest & " " & programArgs) proc xtemp(cmd: string) = let d = getAppDir() copyExe(d / "bin" / "nim".exe, d / "bin" / "nim_backup".exe) try: withDir(d): temp"" copyExe(d / "bin" / "nim_temp".exe, d / "bin" / "nim".exe) exec(cmd) finally: copyExe(d / "bin" / "nim_backup".exe, d / "bin" / "nim".exe) proc pushCsources() = if not dirExists("../csources/.git"): quit "[Error] no csources git repository found" csource("-d:release") let cwd = getCurrentDir() try: copyDir("build/c_code", "../csources/c_code") copyFile("build/build.sh", "../csources/build.sh") copyFile("build/build.bat", "../csources/build.bat") copyFile("build/build64.bat", "../csources/build64.bat") copyFile("build/makefile", "../csources/makefile") setCurrentDir("../csources") for kind, path in walkDir("c_code"): if kind == pcDir: exec("git add " & path / "*.c") exec("git commit -am \"updated csources to version " & NimVersion & "\"") exec("git push origin master") exec("git tag -am \"Version $1\" v$1" % NimVersion) exec("git push origin v$1" % NimVersion) finally: setCurrentDir(cwd) proc testUnixInstall(cmdLineRest: string) = csource("-d:release " & cmdLineRest) xz(false, cmdLineRest) let oldCurrentDir = getCurrentDir() try: let destDir = getTempDir() copyFile("build/nim-$1.tar.xz" % VersionAsString, destDir / "nim-$1.tar.xz" % VersionAsString) setCurrentDir(destDir) execCleanPath("tar -xJf nim-$1.tar.xz" % VersionAsString) setCurrentDir("nim-$1" % VersionAsString) execCleanPath("sh build.sh") # first test: try if './bin/nim --version' outputs something sane: let output = execProcess("./bin/nim --version").splitLines if output.len > 0 and output[0].contains(VersionAsString): echo "Version check: success" execCleanPath("./bin/nim c koch.nim") execCleanPath("./koch boot -d:release", destDir / "bin") # check the docs build: execCleanPath("./koch docs", destDir / "bin") # check nimble builds: execCleanPath("./koch --latest tools") # check the tests work: putEnv("NIM_EXE_NOT_IN_PATH", "NOT_IN_PATH") execCleanPath("./koch tests", destDir / "bin") #execCleanPath("./koch tests cat newconfig", destDir / "bin") else: echo "Version check: failure" finally: setCurrentDir oldCurrentDir proc valgrind(cmd: string) = # somewhat hacky: '=' sign means "pass to valgrind" else "pass to Nim" let args = parseCmdLine(cmd) var nimcmd = "" var valcmd = "" for i, a in args: if i == args.len-1: # last element is the filename: valcmd.add ' ' valcmd.add changeFileExt(a, ExeExt) nimcmd.add ' ' nimcmd.add a elif '=' in a: valcmd.add ' ' valcmd.add a else: nimcmd.add ' ' nimcmd.add a exec("nim c" & nimcmd) let supp = getAppDir() / "tools" / "nimgrind.supp" exec("valgrind --suppressions=" & supp & valcmd) proc showHelp() = quit(HelpText % [VersionAsString & spaces(44-len(VersionAsString)), CompileDate, CompileTime], QuitSuccess) when isMainModule: var op = initOptParser() var latest = false var stable = false while true: op.next() case op.kind of cmdLongOption, cmdShortOption: case normalize(op.key) of "latest": latest = true of "stable": stable = true else: showHelp() of cmdArgument: case normalize(op.key) of "boot": boot(op.cmdLineRest) of "clean": clean(op.cmdLineRest) of "doc", "docs": buildDocs(op.cmdLineRest) of "doc0", "docs0": # undocumented command for Araq-the-merciful: buildDocs(op.cmdLineRest & gaCode) of "pdf": buildPdfDoc(op.cmdLineRest, "doc/pdf") of "csource", "csources": csource(op.cmdLineRest) of "zip": zip(latest, op.cmdLineRest) of "xz": xz(latest, op.cmdLineRest) of "nsis": nsis(latest, op.cmdLineRest) of "geninstall": geninstall(op.cmdLineRest) of "distrohelper": geninstall() of "install": install(op.cmdLineRest) of "testinstall": testUnixInstall(op.cmdLineRest) of "test", "tests": tests(op.cmdLineRest) of "temp": temp(op.cmdLineRest) of "xtemp": xtemp(op.cmdLineRest) of "wintools": bundleWinTools() of "nimble": if stable: buildNimble(false) else: buildNimble(existsDir(".git") or latest) of "nimsuggest": bundleNimsuggest(buildExe=true) of "tools": if stable: buildTools(false) else: buildTools(existsDir(".git") or latest) of "pushcsource", "pushcsources": pushCsources() of "valgrind": valgrind(op.cmdLineRest) else: showHelp() break of cmdEnd: break