refactor!: fix compilation issues

Signed-off-by: Chrysostomos Nanakos <chris@include.gr>
This commit is contained in:
Chrysostomos Nanakos 2026-01-07 16:50:04 +02:00 committed by E M
parent 5a8de1186a
commit 41efa3fc68
No known key found for this signature in database
3 changed files with 17 additions and 44 deletions

View File

@ -3,7 +3,7 @@ mode = ScriptMode.Verbose
import std/os except commandLineParams
### Helper functions
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
proc buildBinary(srcName: string, outName = os.lastPathPart(srcName), srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
@ -18,10 +18,9 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
let
# Place build output in 'build' folder, even if name includes a longer path.
outName = os.lastPathPart(name)
cmd =
"nim " & lang & " --out:build/" & outName & " " & extra_params & " " & srcDir &
name & ".nim"
srcName & ".nim"
exec(cmd)
@ -37,24 +36,25 @@ proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "dynamic")
)
exec "nim c" & " --out:build/" & lib_name &
" --threads:on --app:lib --opt:size --noMain --mm:refc --header --d:metrics " &
"--nimMainPrefix:libcodex -d:noSignalHandler " &
"--nimMainPrefix:libstorage -d:noSignalHandler " &
"-d:LeopardExtraCompilerFlags=-fPIC " & "-d:chronicles_runtime_filtering " &
"-d:chronicles_log_level=TRACE " & params & " " & srcDir & name & ".nim"
else:
exec "nim c" & " --out:build/" & name &
".a --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --d:metrics " &
"--nimMainPrefix:libcodex -d:noSignalHandler " &
"--nimMainPrefix:libstorage -d:noSignalHandler " &
"-d:LeopardExtraCompilerFlags=-fPIC " &
"-d:chronicles_runtime_filtering " &
"-d:chronicles_log_level=TRACE " &
params & " " & srcDir & name & ".nim"
proc test(name: string, srcDir = "tests/", params = "", lang = "c") =
buildBinary name, srcDir, params
exec "build/" & name
proc test(name: string, outName = name, srcDir = "tests/", params = "", lang = "c") =
buildBinary name, outName, srcDir, params
exec "build/" & outName
task codex, "build codex binary":
task storage, "build logos storage binary":
buildBinary "codex",
outname = "storage",
params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
task toolsCirdl, "build tools/cirdl binary":
@ -65,6 +65,7 @@ task testStorage, "Build & run Logos Storage tests":
task testIntegration, "Run integration tests":
buildBinary "codex",
outName = "storage",
params =
"-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
test "testIntegration"
@ -72,11 +73,11 @@ task testIntegration, "Run integration tests":
# test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " &
# "-d:chronicles_enabled_topics:integration:TRACE"
task build, "build codex binary":
codexTask()
task build, "build Logos Storage binary":
storageTask()
task test, "Run tests":
testCodexTask()
testStorageTask()
task testAll, "Run all tests (except for Taiko L2 tests)":
testStorageTask()
@ -133,22 +134,22 @@ task showCoverage, "open coverage html":
if findExe("open") != "":
exec("open coverage/report/index.html")
task libcodexDynamic, "Generate bindings":
task libstorageDynamic, "Generate bindings":
var params = ""
when compiles(commandLineParams):
for param in commandLineParams():
if param.len > 0 and param.startsWith("-"):
params.add " " & param
let name = "libcodex"
let name = "libstorage"
buildLibrary name, "library/", params, "dynamic"
task libcodexStatic, "Generate bindings":
task libstorageStatic, "Generate bindings":
var params = ""
when compiles(commandLineParams):
for param in commandLineParams():
if param.len > 0 and param.startsWith("-"):
params.add " " & param
let name = "libcodex"
let name = "libstorage"
buildLibrary name, "library/", params, "static"

View File

@ -17,15 +17,6 @@ suite "Manifest":
manifest =
Manifest.new(treeCid = Cid.example, blockSize = 1.MiBs, datasetSize = 100.MiBs)
protectedManifest = Manifest.new(
manifest = manifest,
treeCid = Cid.example,
datasetSize = 200.MiBs,
eck = 2,
ecM = 2,
strategy = SteppedStrategy,
)
proc encodeDecode(manifest: Manifest): Manifest =
let e = manifest.encode().tryGet()
Manifest.decode(e).tryGet()

View File

@ -108,22 +108,3 @@ suite "StoreStream - Size Tests":
stream = StoreStream.new(CacheStore.new(), manifest)
check stream.size == 80
test "Should not count parity/padding bytes as part of stream size":
let protectedManifest = Manifest.new(
treeCid = Cid.example,
datasetSize = 120.NBytes, # size including parity bytes
blockSize = 10.NBytes,
version = CIDv1,
hcodec = Sha256HashCodec,
codec = BlockCodec,
ecK = 2,
ecM = 1,
originalTreeCid = Cid.example,
originalDatasetSize = 80.NBytes, # size without parity bytes
strategy = StrategyType.SteppedStrategy,
)
stream = StoreStream.new(CacheStore.new(), protectedManifest)
check stream.size == 80