Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run:
shell: ${{ matrix.shell }}

name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim.ref }})'
name: "${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim.ref }})"
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
nimble install_pinned

- name: Use gcc 14
if : ${{ matrix.platform.os == 'linux-gcc-14'}}
if: ${{ matrix.platform.os == 'linux-gcc-14'}}
run: |
# Add GCC-14 to alternatives
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
Expand All @@ -103,3 +103,16 @@ jobs:

export NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}"
nimble test

- name: Fix xml newlines
if: ${{ !cancelled() }}
run: |
nim c -r tools/fix_xml_newlines.nim

- name: Test Report
uses: dorny/test-reporter@v2
if: ${{ !cancelled() }}
with:
name: Test Report
path: tests/results_*.xml
reporter: jest-junit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ go-libp2p-daemon/
# because it appears that vs code is skipping text search is some tests files without these rules.
tests/**/test*[^.]*
!tests/**/*.*
!tests/**/Dockerfile
!tests/**/Dockerfile
tests/*.xml
6 changes: 5 additions & 1 deletion libp2p.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ proc runTest(filename: string, moreoptions: string = "") =
compileCmd &= " -d:libp2p_gossipsub_1_4"
compileCmd &= " " & moreoptions & " "

var runnerArgs = " --output-level=VERBOSE"
runnerArgs &= " --console"
runnerArgs &= " --xml:tests/results_" & filename.replace("/", "_") & ".xml"

# step 1: compile test binary
exec compileCmd & " tests/" & filename
# step 2: run binary
exec "./tests/" & filename.toExe & " --output-level=VERBOSE"
exec "./tests/" & filename.toExe & runnerArgs
# step 3: remove binary
rmFile "tests/" & filename.toExe

Expand Down
34 changes: 34 additions & 0 deletions tools/fix_xml_newlines.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Nim-LibP2P
# Copyright (c) 2023-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.

import std/[os, xmlparser, xmltree, streams, strutils]

proc processNode(node: var XmlNode) =
if node.kind == xnElement and node.tag == "failure":
let message = node.attr("message").replace("\n", " | ")
let details = node.innerText.replace("\n", " | ")

let combined =
if details.len > 0:
details & " | " & message
else:
message

node.attrs = toXmlAttributes()
node.clear()
node.add(newText(combined))

for i in 0 ..< node.len:
processNode(node[i])

for file in walkFiles("tests/results_*.xml"):
var xml = parseXml(newFileStream(file, fmRead))
processNode(xml)

writeFile(file, $xml)
Loading