From 4200d7428ac200fd7c0fb57e67aed9f492bfb3d5 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 28 Oct 2016 20:04:14 +0200 Subject: Tests: skip long and dangerous tests remove hidden volume test from general test Signed-off-by: Szczepan Zalega --- unittest/test2.cc | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/unittest/test2.cc b/unittest/test2.cc index 94a0dd3..e4edf87 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -1,6 +1,6 @@ #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() -static const char *const default_admin_pin = "12345678"; +static const char *const default_admin_pin = "12345678"; static const char *const default_user_pin = "123456"; #include "catch.hpp" @@ -34,8 +34,19 @@ void execute_password_command(Device &stick, const char *password, const char ki this_thread::sleep_for(1000ms); } +/** + * fail on purpose (will result in failed test) + * disable from running unwillingly + */ +void SKIP_TEST() { + CAPTURE("Failing current test to SKIP it"); + REQUIRE(false); +} + TEST_CASE("long operation test", "[test_long]") { + SKIP_TEST(); + Stick20 stick; bool connected = stick.connect(); REQUIRE(connected == true); @@ -158,7 +169,7 @@ TEST_CASE("setup hidden volume test", "[hidden]") { execute_password_command(stick, hidden_volume_password); } -TEST_CASE("setup multiple hidden volumes", "[hidden2]") { +TEST_CASE("setup multiple hidden volumes", "[hidden]") { Stick20 stick; bool connected = stick.connect(); REQUIRE(connected == true); @@ -190,9 +201,12 @@ TEST_CASE("setup multiple hidden volumes", "[hidden2]") { } } + //in case of a bug this could change update PIN to some unexpected value // - please save log with packet dump if this test will not pass TEST_CASE("update password change", "[dangerous]") { + SKIP_TEST(); + Stick20 stick; bool connected = stick.connect(); REQUIRE(connected == true); @@ -213,7 +227,7 @@ TEST_CASE("update password change", "[dangerous]") { } } - TEST_CASE("general test", "[test]") { +TEST_CASE("general test", "[test]") { Stick20 stick; bool connected = stick.connect(); REQUIRE(connected == true); @@ -223,27 +237,7 @@ TEST_CASE("update password change", "[dangerous]") { stick10::LockDevice::CommandTransaction::run(stick); // execute_password_command(stick, "123456"); // execute_password_command(stick, "123456"); - this_thread::sleep_for(1000ms); - execute_password_command(stick, default_user_pin); - this_thread::sleep_for(4000ms); - bool passed = false; - for(int i=0; i<5; i++){ - try { - execute_password_command(stick, "123123123"); - CHECK(true); - passed=true; - break; - } - catch (CommandFailedException &e){ - this_thread::sleep_for(2000ms); - } - } - if(!passed){ - CHECK(false); - } - - execute_password_command(stick, "123123123"); - +// execute_password_command(stick, "123123123"); execute_password_command(stick, default_user_pin); execute_password_command(stick, default_user_pin); -- cgit v1.2.3