Skip to content

Commit

Permalink
Merge branch 'economic-selftests' into max-next
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Jan 26, 2018
2 parents 86e384f + 2c71c23 commit a0c9d21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/lpm/lpm4.lua
Expand Up @@ -237,6 +237,15 @@ function selftest ()
end
function LPM4:selftest (cfg, millions)
assert(self, "selftest must be called with : ")

if not os.getenv("SNABB_LPM4_TEST_INTENSIVE") then
print("Skipping LPM4:selfest (very specific / excessive runtime)")
print("In case you are hacking on lib.lpm you might want to enable")
print("these tests by setting SNABB_LPM4_TEST_INTENSIVE in your")
print("environment.")
return
end

local trusted = require("lib.lpm.lpm4_trie").LPM4_trie:new()
trusted:add_random_entries()

Expand Down
3 changes: 3 additions & 0 deletions src/lib/numa.lua
Expand Up @@ -128,6 +128,9 @@ function prevent_preemption(priority)
end

function selftest ()
if not has_numa() then
os.exit(engine.test_skipped_code)
end

function test_cpu(cpu)
local node = cpu_get_numa_node(cpu)
Expand Down

0 comments on commit a0c9d21

Please sign in to comment.