|
| 1 | +# Package |
| 2 | + |
| 3 | +version = "0.7.3" |
| 4 | +author = "Eugene Kabanov" |
| 5 | +description = "Nim cryptographic library" |
| 6 | +license = "MIT" |
| 7 | +skipDirs = @["tests", "examples", "Nim", "docs"] |
| 8 | + |
| 9 | +# Dependencies |
| 10 | + |
| 11 | +requires "nim >= 1.6" |
| 12 | + |
| 13 | +# Tests |
| 14 | + |
| 15 | +let |
| 16 | + nimc = getEnv("NIMC", "nim") # Which nim compiler to use |
| 17 | + |
| 18 | +task test, "Runs the test suite": |
| 19 | + var testCommands = @[ |
| 20 | + nimc & " c -f -r tests/", |
| 21 | + nimc & " c -f -d:danger -r tests/", |
| 22 | + nimc & " c -f -d:danger --threads:on -r tests/", |
| 23 | + nimc & " c -f --passC=\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" --passL:\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" -r tests/", |
| 24 | + ] |
| 25 | + |
| 26 | + # Nim version 1.6 compiler crashes with `out of memory` on i386. |
| 27 | + when defined(cpu64): |
| 28 | + testCommands.add nimc & " c -f --mm:orc --threads:on -r tests/" |
| 29 | + else: |
| 30 | + when (NimMajor, NimMinor) >= (2, 0): |
| 31 | + testCommands.add nimc & " c -f --mm:orc --threads:on -r tests/" |
| 32 | + |
| 33 | + when (NimMajor, NimMinor) >= (2, 0): |
| 34 | + testCommands.add nimc & " c -f --mm:refc --threads:off --passC=\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" --passL:\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" -r tests/" |
| 35 | + testCommands.add nimc & " c -f --mm:refc --threads:on --passC=\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" --passL:\"-fsanitize=undefined -fsanitize-undefined-trap-on-error\" -r tests/" |
| 36 | + testCommands.add nimc & " c -f --mm:refc --threads:off -r tests/" |
| 37 | + testCommands.add nimc & " c -f --mm:refc --threads:on -r tests/" |
| 38 | + |
| 39 | + let exampleFiles = @[ |
| 40 | + "ecb", "cbc", "ofb", "cfb", "ctr", "gcm" |
| 41 | + ] |
| 42 | + var exampleCommands = @[ |
| 43 | + nimc & " c -f -r --threads:on examples/", |
| 44 | + nimc & " c -f --mm:orc --threads:on -r examples/" |
| 45 | + ] |
| 46 | + |
| 47 | + for cmd in testCommands: |
| 48 | + echo "\n" & cmd & "testall" |
| 49 | + exec cmd & "testall" |
| 50 | + rmFile("tests/testall".toExe()) |
| 51 | + |
| 52 | + for efile in exampleFiles: |
| 53 | + for cmd in exampleCommands: |
| 54 | + echo "\n" & cmd & efile |
| 55 | + exec cmd & efile |
| 56 | + rmFile("examples/" & efile.toExe()) |
| 57 | + |
| 58 | + exec(nimc & " c -f -r -d:nimcryptoLowercase tests/testapi") |
| 59 | + exec(nimc & " c -f -r -d:nimcrypto0xPrefix tests/testapi") |
| 60 | + exec(nimc & " c -f -r -d:nimcrypto0xPrefix -d:nimcryptoLowercase tests/testapi") |
0 commit comments