From b936eb5394b5c095ef3beeb4851828775ed35ed2 Mon Sep 17 00:00:00 2001 From: David Byers <byers@lysator.liu.se> Date: Fri, 15 Jan 1999 11:07:46 +0000 Subject: [PATCH] More test cases --- src/server/testsuite/lyskomd.0/admin-cov.exp | 78 ++++++++++++ .../testsuite/lyskomd.0/aux-items-cov.exp | 119 ++++++++++++++++++ src/server/testsuite/lyskomd.0/aux-items.cov | 28 +++++ 3 files changed, 225 insertions(+) create mode 100644 src/server/testsuite/lyskomd.0/admin-cov.exp create mode 100644 src/server/testsuite/lyskomd.0/aux-items-cov.exp create mode 100644 src/server/testsuite/lyskomd.0/aux-items.cov diff --git a/src/server/testsuite/lyskomd.0/admin-cov.exp b/src/server/testsuite/lyskomd.0/admin-cov.exp new file mode 100644 index 000000000..a821ec155 --- /dev/null +++ b/src/server/testsuite/lyskomd.0/admin-cov.exp @@ -0,0 +1,78 @@ +# +# Supplementary test suites to get statement coverage of admin.c +# +# Note: 100% coverage is not possible. +# set_motd_of_lyskom: The error for old motd not marked cannot be +# provoked without reading a bad database. +# + + +read_versions +source "config/prot-a.exp" + + +lyskomd_start "" \ +"Max marks per text: 1 +Max broadcast length: 10" + +client_start 0 +talk_to client 0 + +send "A[holl "DejaGnu test suite"]\n" +simple_expect "LysKOM" +kom_accept_async "1 { 12 }" + + +# Attempt to do set-info of non-existent text + +kom_login 5 "gazonk" 0 +kom_enable 255 +send "1000 79 0 1 2 3 4 1\n" +simple_expect "%1000 14 1" + +# Attempt to do set-info without privs + +kom_enable 0 +send "1001 86 [holl "Text"] 1 { 0 1 } 0 { }\n" +simple_expect "=1001 1" + +send "1002 79 0 1 2 3 4 1\n" +simple_expect "%1002 12 0" + +# Attempt to do set-info with too many marks on the text + +kom_enable 255 +send "1003 72 1 1\n" +simple_expect "=1003" + +send "1005 79 0 1 2 3 4 1\n" +simple_expect "%1005 36 1" +kom_enable 0 + + +# Send a long message + +send "2000 53 0 [holl "1234567890X"]\n" +simple_expect "%2000 5 10" + +# Send a message to a non-existent conference + +send "2001 53 6 [holl "FUBAR"]\n" +simple_expect "%2001 9 6" + +# Attempt to shut down LysKOM without privs + +send "3000 44 0\n" +simple_expect "%3000 12 0" + + + +# Finish + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 +send "9999 44 0\n" +simple_expect "=9999" +client_death 0 +lyskomd_death diff --git a/src/server/testsuite/lyskomd.0/aux-items-cov.exp b/src/server/testsuite/lyskomd.0/aux-items-cov.exp new file mode 100644 index 000000000..7a7766a71 --- /dev/null +++ b/src/server/testsuite/lyskomd.0/aux-items-cov.exp @@ -0,0 +1,119 @@ +# +# Supplementary test suites to get statement coverage of aux-items.c +# +# We can't get 100% coverage +# There's a check on the definition pointer in aux_item_add_perm +# but the pointer passed to this function is never NULL in the +# current code. +# +# It's difficult to test out-of-memory conditions +# Out of memory condition when adding aux-item +# Out of memory compiling validaion regexp +# Out of memory condition in query_predefined_aux_items +# +# Some code is just really hard to reach +# Internal error in regexp matcher +# Invalid trigger name kills the server. It's been tested though. +# +# check_delete_aux_item_list with deleted items in list +# I don't think this is possible any more +# +# In delete_aux_item_list, the check for call to check_delete_ax_item_list +# This probably can't be triggered + +# Optimization artifacts +# With -O2 we will never get 100% coverage +# return at end of aux_item_find_trigger gets optimized to oblivion +# The continue in aux_iherit_items is not hit +# +# Call to system_check_add_aux_item_list with NULL list +# This can't be triggered + + +# Missing tests +# Test precompiled aux-items. We don't have any yet. +# +# We get in to aux_item_add_perm without a valid item tag +# Call to aux_item_inherit_items with no parent or no target +# Same thing in undelete +# Try to add an item with no definition to system + +read_versions +source "config/prot-a.exp" + + +lyskomd_start "lyskomd.0/aux-items.cov" + +client_start 0 +talk_to client 0 + +send "A[holl "DejaGnu test suite"]\n" +simple_expect "LysKOM" + +# Do something that gets the default aux-item definition + +kom_accept_async "0 { }" +kom_login 5 "gazonk" 0 + +send "1000 86 [holl "Text"] 1 { 0 5 } 1 { 10000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "=1000 1" + +# Try an illegal aux-item tag + +send "1001 86 [holl "Text"] 1 { 0 5 } 1 { 0 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%1001 48 0" + +# Try an undefined aux-item in the predefined range + +send "1002 86 [holl "Text"] 1 { 0 5 } 1 { 9999 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%1002 48 0" + + +# Try adding an aux-item that has an item with an invalid validation + +send "1003 86 [holl "Text"] 1 { 0 5 } 1 { 1000 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%1003 48 0" + +# Create a valid text +send "2000 86 [holl "Text"] 1 { 0 1 } 1 { 1001 01000000 0 [holl "FUBAR"] }\n" +simple_expect "=2000 2" + +kom_logout +kom_create_person "P1" "joshua5" "0 { }" + +kom_login 6 "joshua5" 0 +send "2001 86 [holl "Comment"] 2 { 0 1 2 2 } 0 { }\n" +simple_expect "=2001 3" + +# Add an item with NULL definition to conference + +send "3000 93 1 0 { } 1 { 0 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%3000 48 0" + +kom_login 5 "gazonk" 0 +kom_enable 255 + +send "3001 95 0 { } 1 { 0 00000000 0 [holl "FUBAR"] }\n" +simple_expect "%3001 48 0" + + +# Attempt to create aux-item with mark-text trigger with no valid text + +send "4000 93 1 0 { } 2 { 1003 00000000 0 [holl "999"] 1004 00000000 0 [holl "999"] }\n" +simple_expect "=4000" + +# Attempt to use unmark-text trigger on item not on conf + +send "4001 95 0 { } 1 { 1004 00000000 0 [holl "999"] }\n" +simple_expect "=4001" + + +# Finish + +kom_logout +kom_login 5 "gazonk" 0 +kom_enable 255 +send "9999 44 0\n" +simple_expect "=9999" +client_death 0 +lyskomd_death diff --git a/src/server/testsuite/lyskomd.0/aux-items.cov b/src/server/testsuite/lyskomd.0/aux-items.cov new file mode 100644 index 000000000..8f3ee976e --- /dev/null +++ b/src/server/testsuite/lyskomd.0/aux-items.cov @@ -0,0 +1,28 @@ +# +# Test suite aux items +# + +1000 : invalid-regexp (any) +{ + validate = "ABC[Foo>)"; +} + +1001 : author-only (any) +{ + author-only = true; +} + +# 1002 : invalid-trigger (any) +# { +# add-trigger = fubar(); +# } + +1003 : mark-text (any) +{ + add-trigger = mark-text(); +} + +1004 : unmark-text (any) +{ + add-trigger = unmark-text(); +} -- GitLab