* [tarantool-patches] [PATCH] Add test case for fiber safety of digest.pbkdf2
@ 2018-05-15 11:04 Alexander Turenko
2018-05-15 13:34 ` [tarantool-patches] " Kirill Yukhin
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Turenko @ 2018-05-15 11:04 UTC (permalink / raw)
To: Ilya Markov, Kirill Yukhin; +Cc: Alexander Turenko, tarantool-patches
Follows up #3396.
---
branch: Totktonada/gh-3396-fiber-safe-pbkdf2-test
travis-ci: https://travis-ci.org/tarantool/tarantool/builds/379156714
test/app/digest.result | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
test/app/digest.test.lua | 19 +++++++++++++++
2 files changed, 79 insertions(+)
diff --git a/test/app/digest.result b/test/app/digest.result
index bf1815136..d41efde3f 100644
--- a/test/app/digest.result
+++ b/test/app/digest.result
@@ -5,6 +5,9 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua:<line>\"]: '")
---
- true
...
+fiber = require('fiber')
+---
+...
digest = require('digest')
---
...
@@ -576,3 +579,60 @@ test_run:cmd("clear filter")
---
- true
...
+-- gh-3396: fiber-safe pbkdf2
+res = {}
+---
+...
+sentry = fiber.channel()
+---
+...
+_ = test_run:cmd("setopt delimiter ';'")
+---
+...
+function test_pbkdf2()
+ local digest = require('digest')
+ for i = 1, 10 do
+ table.insert(res, digest.pbkdf2('', 'salt', 100, 32):hex())
+ end
+ sentry:put(fiber.id())
+end;
+---
+...
+_ = test_run:cmd("setopt delimiter ''");
+---
+...
+_ = fiber.create(test_pbkdf2)
+---
+...
+_ = fiber.create(test_pbkdf2)
+---
+...
+_ = sentry:get()
+---
+...
+_ = sentry:get()
+---
+...
+res
+---
+- - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+ - bafac115a0022b2894f2983b5b5102455bdd3ba7cfbeb09f219a9fde8f3ee6a9
+...
diff --git a/test/app/digest.test.lua b/test/app/digest.test.lua
index 3134efc92..7ecda91bc 100644
--- a/test/app/digest.test.lua
+++ b/test/app/digest.test.lua
@@ -1,6 +1,7 @@
test_run = require('test_run').new()
test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua:<line>\"]: '")
+fiber = require('fiber')
digest = require('digest')
type(digest)
@@ -184,3 +185,21 @@ s
err:match("number")
digest = nil
test_run:cmd("clear filter")
+
+-- gh-3396: fiber-safe pbkdf2
+res = {}
+sentry = fiber.channel()
+_ = test_run:cmd("setopt delimiter ';'")
+function test_pbkdf2()
+ local digest = require('digest')
+ for i = 1, 10 do
+ table.insert(res, digest.pbkdf2('', 'salt', 100, 32):hex())
+ end
+ sentry:put(fiber.id())
+end;
+_ = test_run:cmd("setopt delimiter ''");
+_ = fiber.create(test_pbkdf2)
+_ = fiber.create(test_pbkdf2)
+_ = sentry:get()
+_ = sentry:get()
+res
--
2.15.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tarantool-patches] Re: [PATCH] Add test case for fiber safety of digest.pbkdf2
2018-05-15 11:04 [tarantool-patches] [PATCH] Add test case for fiber safety of digest.pbkdf2 Alexander Turenko
@ 2018-05-15 13:34 ` Kirill Yukhin
0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2018-05-15 13:34 UTC (permalink / raw)
To: Alexander Turenko; +Cc: Ilya Markov, tarantool-patches
Hello Alex,
On 15 мая 14:04, Alexander Turenko wrote:
> Follows up #3396.
> ---
I've checked in your changes.
--
Regards, Kirill Yukhin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-15 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 11:04 [tarantool-patches] [PATCH] Add test case for fiber safety of digest.pbkdf2 Alexander Turenko
2018-05-15 13:34 ` [tarantool-patches] " Kirill Yukhin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox