diff --git a/build.nims b/build.nims index d9dac119..a8e35405 100644 --- a/build.nims +++ b/build.nims @@ -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" diff --git a/tests/codex/testmanifest.nim b/tests/codex/testmanifest.nim index 82583b31..f9ba0702 100644 --- a/tests/codex/testmanifest.nim +++ b/tests/codex/testmanifest.nim @@ -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() diff --git a/tests/codex/teststorestream.nim b/tests/codex/teststorestream.nim index 1de83604..801302e3 100644 --- a/tests/codex/teststorestream.nim +++ b/tests/codex/teststorestream.nim @@ -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