@@ -319,6 +319,7 @@ static void torture_options_set_port(void **state) {
319319
320320 rc = ssh_options_set (session , SSH_OPTIONS_PORT_STR , "five" );
321321 assert_true (rc == -1 );
322+ assert_int_not_equal (session -> opts .port , 0 );
322323
323324 rc = ssh_options_set (session , SSH_OPTIONS_PORT , NULL );
324325 assert_true (rc == -1 );
@@ -1279,6 +1280,26 @@ static void torture_options_apply (void **state) {
12791280 ssh_list_free (awaited_list );
12801281}
12811282
1283+ static void torture_options_set_verbosity (void * * state )
1284+ {
1285+ ssh_session session = * state ;
1286+ int rc , new_level ;
1287+
1288+ rc = ssh_options_set (session ,
1289+ SSH_OPTIONS_LOG_VERBOSITY_STR ,
1290+ "3" );
1291+ assert_int_equal (rc , SSH_OK );
1292+ new_level = ssh_get_log_level ();
1293+ assert_int_equal (new_level , SSH_LOG_PACKET );
1294+
1295+ rc = ssh_options_set (session ,
1296+ SSH_OPTIONS_LOG_VERBOSITY_STR ,
1297+ "datsun" );
1298+ assert_int_equal (rc , -1 );
1299+ new_level = ssh_get_log_level ();
1300+ assert_int_not_equal (new_level , 0 );
1301+ }
1302+
12821303#ifdef WITH_SERVER
12831304const char template [] = "temp_dir_XXXXXX" ;
12841305
@@ -1533,6 +1554,10 @@ static void torture_bind_options_bindport_str(void **state)
15331554 rc = ssh_bind_options_set (bind , SSH_BIND_OPTIONS_BINDPORT_STR , "23" );
15341555 assert_int_equal (rc , 0 );
15351556 assert_int_equal (bind -> bindport , 23 );
1557+
1558+ rc = ssh_bind_options_set (bind , SSH_BIND_OPTIONS_BINDPORT_STR , "twentythree" );
1559+ assert_int_equal (rc , -1 );
1560+ assert_int_not_equal (bind -> bindport , 0 );
15361561}
15371562
15381563static void torture_bind_options_log_verbosity (void * * state )
@@ -1582,6 +1607,11 @@ static void torture_bind_options_log_verbosity_str(void **state)
15821607 new_level = ssh_get_log_level ();
15831608 assert_int_equal (new_level , SSH_LOG_PACKET );
15841609
1610+ rc = ssh_bind_options_set (bind , SSH_BIND_OPTIONS_LOG_VERBOSITY_STR , "verbosity" );
1611+ assert_int_equal (rc , -1 );
1612+ new_level = ssh_get_log_level ();
1613+ assert_int_not_equal (new_level , 0 );
1614+
15851615 rc = ssh_set_log_level (previous_level );
15861616 assert_int_equal (rc , SSH_OK );
15871617}
@@ -2074,6 +2104,7 @@ int torture_run_tests(void) {
20742104 cmocka_unit_test_setup_teardown (torture_options_getopt ,
20752105 setup , teardown ),
20762106 cmocka_unit_test_setup_teardown (torture_options_apply , setup , teardown ),
2107+ cmocka_unit_test_setup_teardown (torture_options_set_verbosity , setup , teardown ),
20772108 };
20782109
20792110#ifdef WITH_SERVER
0 commit comments