Skip to content

Commit

Permalink
Fix test suite (#116)
Browse files Browse the repository at this point in the history
* Pin nim-serialization. Workaround #113 and status-im/nim-serialization#33

* Need to workaround nimble installing dependency multiple times

* non-interactive

* UB sanitizer missing on mingw

* Fix OpenSSL benchmark on non-Linux platforms

* Accelerate CI:
- Skip 32-bit on 64-bit tests
- Only test leaf functionality.

* Don't define -fstack-protector-all with MinGW

* skip line functions and cyclotomic tests (already tested in pairing) + only compile the benches don't run them.
  • Loading branch information
mratsim authored Jan 21, 2021
1 parent 023e690 commit ac63005
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 140 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,14 @@ jobs:
rm -rf .git
- name: Install test dependencies
shell: bash
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
run: |
nimble refresh
nimble install -y gmp stew serialization json_serialization
nimble install -y gmp stew json_serialization
nimble uninstall -y serialization
nimble install serialization@#217d78a
- name: Run Constantine tests (with Assembler & with GMP)
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.cpu == 'amd64'
shell: bash
Expand Down
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ before_script:
- export PATH="$PWD/nim-${CHANNEL}/bin${PATH:+:$PATH}"
script:
- nimble refresh
- nimble install -y gmp stew serialization json_serialization
- nimble install -y gmp stew json_serialization
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
- nimble uninstall -y serialization
- nimble install serialization@#217d78a

# Installing Clang9.0 or later is a pain in Travis
# for inline assembly "flag output constraint"
# Also MacOS build is timing out with 2 series of tests.
Expand Down
7 changes: 6 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,15 @@ steps:
displayName: 'Downloading GMP (Linux 32-bit)'
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['UCPU'], 'i686'))
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
- bash: |
echo "PATH=${PATH}"
nimble refresh
nimble install -y gmp stew serialization json_serialization
nimble install -y gmp stew json_serialization
nimble uninstall -y serialization
nimble install serialization@#217d78a
displayName: 'Installing package and testing dependencies'
- bash: |
Expand Down
27 changes: 26 additions & 1 deletion benchmarks/bench_sha256.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,41 @@ import

proc separator*() = separator(69)

# Deal with platform mess
# --------------------------------------------------------------------
when defined(windows):
when sizeof(int) == 8:
const DLLSSLName* = "(libssl-1_1-x64|ssleay64|libssl64).dll"
else:
const DLLSSLName* = "(libssl-1_1|ssleay32|libssl32).dll"
else:
when defined(macosx):
const versions = "(.1.1|.38|.39|.41|.43|.44|.45|.46|.47|.48|.10|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|)"
else:
const versions = "(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|)"

when defined(macosx):
const DLLSSLName* = "libssl" & versions & ".dylib"
elif defined(genode):
const DLLSSLName* = "libssl.lib.so"
else:
const DLLSSLName* = "libssl.so" & versions

# OpenSSL wrapper
# --------------------------------------------------------------------

proc SHA256[T: byte|char](
msg: openarray[T],
digest: ptr array[32, byte] = nil
): ptr array[32, byte] {.cdecl, dynlib: "libssl.so", importc.}
): ptr array[32, byte] {.cdecl, dynlib: DLLSSLName, importc.}

proc SHA256_OpenSSL[T: byte|char](
digest: var array[32, byte],
s: openarray[T]) =
discard SHA256(s, digest.addr)

# --------------------------------------------------------------------

proc report(op: string, bytes: int, startTime, stopTime: MonoTime, startClk, stopClk: int64, iters: int) =
let ns = inNanoseconds((stopTime-startTime) div iters)
let throughput = 1e9 / float64(ns)
Expand Down
Loading

0 comments on commit ac63005

Please sign in to comment.