Merge lp:~thomas-voss/biometryd/identify-in-a-loop-for-test into lp:biometryd

Proposed by Thomas Voß
Status: Merged
Approved by: Thomas Voß
Approved revision: 22
Merged at revision: 21
Proposed branch: lp:~thomas-voss/biometryd/identify-in-a-loop-for-test
Merge into: lp:biometryd
Diff against target: 56 lines (+14/-5)
2 files modified
src/biometry/cmds/test.cpp (+12/-5)
src/biometry/cmds/test.h (+2/-0)
To merge this branch: bzr merge lp:~thomas-voss/biometryd/identify-in-a-loop-for-test
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+295190@code.launchpad.net

Commit message

For cmds::Test, enable multiple independent trials for identifying the user.

Description of the change

For cmds::Test, enable multiple independent trials for identifying the user.

To post a comment you must log in.
22. By Thomas Voß

Adjust doc string.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/biometry/cmds/test.cpp'
2--- src/biometry/cmds/test.cpp 2016-05-11 15:03:29 +0000
3+++ src/biometry/cmds/test.cpp 2016-05-19 10:48:37 +0000
4@@ -45,11 +45,12 @@
5 }
6
7 biometry::cmds::Test::Test()
8- : CommandWithFlagsAndAction{cli::Name{"test"}, cli::Usage{"executes runtime tests for a device"}, cli::Description{"executes runtime tests for a device"}},
9- user{biometry::User::current()}
10+ : CommandWithFlagsAndAction{cli::Name{"test"}, cli::Usage{"executes runtime tests for a device"}, cli::Description{"executes runtime tests for a device"}}
11 {
12 flag(cli::make_flag(cli::Name{"config"}, cli::Description{"configuration file for the test"}, config));
13- flag(cli::make_flag(cli::Name{"user"}, cli::Description{"The numeric user id for testing purposes"}, user));
14+ flag(cli::make_flag(cli::Name{"user"}, cli::Description{"The numeric user id for testing purposes"}, user = biometry::User::current()));
15+ flag(cli::make_flag(cli::Name{"trials"}, cli::Description{"Number of identification trials"}, trials = 20));
16+
17 action([this](const cli::Command::Context& ctxt)
18 {
19 if (not config) throw cli::Command::FlagsMissing{};
20@@ -119,8 +120,14 @@
21 std::make_shared<biometry::TracingObserver<biometry::TemplateStore::SizeQuery>>(2, ctxt.cout));
22
23 ctxt.cout << "Identifying user:" << std::endl;
24- device->identifier().identify_user(biometry::Application::system(), biometry::Reason{"testing"})->start_with_observer(
25- std::make_shared<biometry::TracingObserver<biometry::Identification>>(2, ctxt.cout));
26+
27+ for (std::uint32_t i = 0; i < trials; i++)
28+ {
29+ ctxt.cout << " Trial " << i << ": " << std::endl;
30+ device->identifier().identify_user(biometry::Application::system(), biometry::Reason{"testing"})
31+ ->start_with_observer(
32+ std::make_shared<biometry::TracingObserver<biometry::Identification>>(4, ctxt.cout));
33+ }
34
35 return EXIT_SUCCESS;
36 }
37
38=== modified file 'src/biometry/cmds/test.h'
39--- src/biometry/cmds/test.h 2016-05-11 15:03:29 +0000
40+++ src/biometry/cmds/test.h 2016-05-19 10:48:37 +0000
41@@ -47,6 +47,7 @@
42 // OPTIONS:
43 // --config configuration file for the test
44 // --user The numeric user id for testing purposes
45+// --trials Number of identification trials
46 class BIOMETRY_DLL_PUBLIC Test : public util::cli::CommandWithFlagsAndAction
47 {
48 public:
49@@ -66,6 +67,7 @@
50 private:
51 Optional<boost::filesystem::path> config;
52 User user;
53+ std::uint32_t trials;
54 };
55 }
56 }

Subscribers

People subscribed via source and target branches