summaryrefslogtreecommitdiffstats
path: root/test/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-03 13:58:49 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-03 13:58:49 +0100
commit0a390cfc72d0c5472605327a3d277cdf5dfa9360 (patch)
treee0330c24421783335ded847c5947d0a4fa81dada /test/lua
parent28005bfdd441e313132b31f64497a86d0e27da62 (diff)
downloadrspamd-0a390cfc72d0c5472605327a3d277cdf5dfa9360.tar.gz
rspamd-0a390cfc72d0c5472605327a3d277cdf5dfa9360.zip
[Minor] Reduce speed test cycles in unit tests
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/unit/base64.lua15
-rw-r--r--test/lua/unit/siphash.lua14
2 files changed, 17 insertions, 12 deletions
diff --git a/test/lua/unit/base64.lua b/test/lua/unit/base64.lua
index 1ed04f6f7..add031a45 100644
--- a/test/lua/unit/base64.lua
+++ b/test/lua/unit/base64.lua
@@ -114,9 +114,12 @@ vehemence of any carnal pleasure.]]
assert_equal(cmp, 0, "fuzz test failed for length: " .. tostring(l))
end
end)
+
+ local speed_iters = 10000
+
test("Base64 test reference vectors 1K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 1000000, 1024)
+ local res = ffi.C.base64_test(true, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (1K): " .. tostring(t2 - t1) .. " sec")
@@ -124,7 +127,7 @@ vehemence of any carnal pleasure.]]
end)
test("Base64 test optimized vectors 1K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 1000000, 1024)
+ local res = ffi.C.base64_test(false, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (1K): " .. tostring(t2 - t1) .. " sec")
@@ -132,7 +135,7 @@ vehemence of any carnal pleasure.]]
end)
test("Base64 test reference vectors 512", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 1000000, 512)
+ local res = ffi.C.base64_test(true, speed_iters, 512)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (512): " .. tostring(t2 - t1) .. " sec")
@@ -140,7 +143,7 @@ vehemence of any carnal pleasure.]]
end)
test("Base64 test optimized vectors 512", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 1000000, 512)
+ local res = ffi.C.base64_test(false, speed_iters, 512)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (512): " .. tostring(t2 - t1) .. " sec")
@@ -148,7 +151,7 @@ vehemence of any carnal pleasure.]]
end)
test("Base64 test reference vectors 10K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(true, 100000, 10240)
+ local res = ffi.C.base64_test(true, speed_iters / 100, 10240)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference base64 (10K): " .. tostring(t2 - t1) .. " sec")
@@ -156,7 +159,7 @@ vehemence of any carnal pleasure.]]
end)
test("Base64 test optimized vectors 10K", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.base64_test(false, 100000, 10240)
+ local res = ffi.C.base64_test(false, speed_iters / 100, 10240)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized base64 (10K): " .. tostring(t2 - t1) .. " sec")
diff --git a/test/lua/unit/siphash.lua b/test/lua/unit/siphash.lua
index 3c92d2581..13f02eaf3 100644
--- a/test/lua/unit/siphash.lua
+++ b/test/lua/unit/siphash.lua
@@ -11,9 +11,11 @@ context("Siphash check functions", function()
ffi.C.rspamd_cryptobox_init()
+ local speed_iters = 1000
+
test("Siphash test reference vectors (1KB)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 100000, 1024)
+ local res = ffi.C.siphash24_test(true, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (1KB): " .. tostring(t2 - t1) .. " sec")
@@ -21,7 +23,7 @@ context("Siphash check functions", function()
end)
test("Siphash test optimized vectors (1KB)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 100000, 1024)
+ local res = ffi.C.siphash24_test(false, speed_iters, 1024)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (1KB): " .. tostring(t2 - t1) .. " sec")
@@ -29,7 +31,7 @@ context("Siphash check functions", function()
end)
test("Siphash test reference vectors (5B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 1000000, 5)
+ local res = ffi.C.siphash24_test(true, speed_iters, 5)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (5B): " .. tostring(t2 - t1) .. " sec")
@@ -37,7 +39,7 @@ context("Siphash check functions", function()
end)
test("Siphash test optimized vectors (5B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 1000000, 5)
+ local res = ffi.C.siphash24_test(false, speed_iters, 5)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (5B): " .. tostring(t2 - t1) .. " sec")
@@ -45,7 +47,7 @@ context("Siphash check functions", function()
end)
test("Siphash test reference vectors (50B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(true, 1000000, 50)
+ local res = ffi.C.siphash24_test(true, speed_iters, 50)
local t2 = ffi.C.rspamd_get_ticks()
print("Reference siphash (50B): " .. tostring(t2 - t1) .. " sec")
@@ -53,7 +55,7 @@ context("Siphash check functions", function()
end)
test("Siphash test optimized vectors (50B)", function()
local t1 = ffi.C.rspamd_get_ticks()
- local res = ffi.C.siphash24_test(false, 1000000, 50)
+ local res = ffi.C.siphash24_test(false, speed_iters, 50)
local t2 = ffi.C.rspamd_get_ticks()
print("Optimized siphash (50B): " .. tostring(t2 - t1) .. " sec")