Commit d8d9c2c4 authored by David Byers's avatar David Byers
Browse files

Test cases

        Test for leaks when the parser truncates long arrays
        Test for leaks in the aux-item definition parser
        Baseline start-login-stop test case
parent 53acf950
# Test for leaks when we have to truncate stuff
read_versions
source "$srcdir/config/leaks.exp"
# ----------------------------------------------------------------------
# Test for leaks in text creation
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
send "1000 69 [holl "1234567890"] [holl "1234567890"]\n"
simple_expect "%1000 5 1"
shutdown_leaks
read_usage_base
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
for { set i 0 } { $i < 200 } { incr i 1 } {
# String truncation
send "[expr 1000 + $i] 69 [holl "1234567890"] [holl "1234567890"]\n"
simple_expect "%[expr 1000 + $i] 5 1"
}
shutdown_leaks
check_usage "String truncation" "leaks09-1"
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
send "2000 95 0 { } 10 { 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] }\n"
simple_expect "%2000 46 $any_num"
shutdown_leaks
read_usage_base
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
for { set i 0 } { $i < 200 } { incr i 1 } {
# Aux-item list truncation
send "[expr 2000 + $i] 95 0 { } 10 { 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] 10000 00000000 0 [holl "X"] }\n"
simple_expect "%[expr 2000 + $i] 46 $any_num"
}
shutdown_leaks
check_usage "Aux item list truncation" "leaks09-2"
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
send "3000 95 10 { 1 2 3 4 5 6 7 8 9 10 } 0 { }\n"
simple_expect "%3000 46 $any_num"
shutdown_leaks
read_usage_base
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
for { set i 0 } { $i < 200 } { incr i 1 } {
# Num-list truncation
send "[expr 3000 + $i] 95 10 { 1 2 3 4 5 6 7 8 9 10 } 0 { }\n"
simple_expect "%[expr 3000 + $i] 46 $any_num"
}
shutdown_leaks
check_usage "Number list truncation" "leaks09-3"
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
send "4000 86 [holl "X"] 10 { 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 } 0 { }\n"
simple_expect "%4000 46 $any_num"
shutdown_leaks
read_usage_base
startup_leaks "" "\
Max client data length: 1
Max aux_items added per call: 1
Max aux_items deleted per call: 1
Max links per text: 1"
for { set i 0 } { $i < 200 } { incr i 1 } {
# Misc-info-list truncation
send "[expr 4000 + $i] 86 [holl "X"] 10 { 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 } 0 { }\n"
simple_expect "%[expr 4000 + $i] 46 $any_num"
}
shutdown_leaks
check_usage "Misc-info list truncation" "leaks09-4"
# Test for leaks in the aux-item definition parser
read_versions
source "$srcdir/config/leaks.exp"
startup_leaks "$srcdir/leaks.0/no-aux-items.conf"
shutdown_leaks
read_usage_base
startup_leaks "$srcdir/leaks.0/lots-aux-items.conf"
shutdown_leaks
check_usage "Aux item definition parser" auxp
#
# $Id: lots-aux-items.conf,v 1.1 1999/05/21 11:44:32 byers Exp $
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
#
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING. If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
#
# Content type of a text (MIME type)
#
1 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
100 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
101 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
102 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
103 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
104 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
105 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
106 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
107 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
108 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
109 : content-type (text)
{
author-only = true;
unique = true;
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^.*/.*$";
validate = existing-readable-text();
add-trigger = mark-text();
delete-trigger = unmark-text();
undelete-trigger = mark-text();
}
#
# Quick reply to a text
#
2 : fast-reply (text)
{
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Cross reference from one object to another
#
3 : cross-reference (text, conference, letterbox)
{
dont-garb = false;
inherit = false;
inherit-limit = 1;
validate = "^[CTP][0-9]+";
}
#
# Request for no comments to a text
#
4 : no-comments (text)
{
secret = false;
hide-creator = false;
author-only = true;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Request for personal comments only
#
5 : personal-comment (text)
{
secret = false;
hide-creator = false;
author-only = true;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Request for read confirmation
#
6 : request-confirmation (text)
{
secret = false;
unique = true;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Read confirmation (creator has read the text)
#
7 : read-confirm (text)
{
secret = false;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
permanent = true;
}
#
# Request redirect of texts from one conference to another or to e-mail
#
8 : redirect (conference, letterbox)
{
dont-garb = false;
supervisor-only = true;
validate = "^(LysKOM|E-mail):";
}
#
# Graphics in compface format
#
9 : x-face (conference, letterbox, server)
{
secret = false;
hide-creator = false;
supervisor-only = true;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Alternate name (subject or name) selected by the creator
#
10 : alternate-name (text, conference, letterbox)
{
dont-garb = false;
inherit = false;
}
#
# PGP signature of a text (created with pgp -fsba)
#
11 : pgp-signature (text)
{
permanent = true;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# Public key of a person
#
12 : pgp-public-key (letterbox)
{
author-only = true;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# E-mail address of a person or conference
#
13 : e-mail-address (conference, letterbox, server)
{
author-only = true;
hide-creator = false;
dont-garb = false;
inherit = false;
inherit-limit = 1;
}
#
# FAQ in Text
#
14 : faq-text (conference, server)
{
author-only = true;
hide-creator = false;
secret = false;
inherit = false;
inherit-limit = 1;
add-trigger = link-faq();
validate = "^[0-9][0-9]*$";
validate = existing-readable-text();
}
#
# Name of the creating software
#
15 : creating-software (text)
{
author-only = true;
permanent = true;
unique = true;
hide-creator = false;
dont-garb = false;
inherit = false;
}
#
# Name of actual author.
#
16 : mx-author (create text)
{
author-only = true;
unique = true;
}
#
# From header of an imported e-mail
#
17 : mx-from (text)
{
author-only = true;
unique = false;
}
#
# Reply-To header of an imported e-mail
#
18 : mx-reply-to (text)
{
author-only = true;
unique = false;
}
#
# To header of an imported or to-be-exported e-mail
#
19 : mx-to (text)
{
author-only = false;
unique = false;
hide-creator = false;
secret = false;
}
#
# CC header of an imported or to-be-exported e-mail
#
20 : mx-cc (text)
{
author-only = false;
unique = false;
hide-creator = false;
secret = false;
}
#
# Date header of an imported e-mail
#
21 : mx-date (text)
{
author-only = true;
unique = true;
inherit = false;
validate = "[0-9][0-9][0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\\( [-+][0-9][0-9][0-9][0-9]\\)?";
}
#
# Message-ID header of an imported e-mail
#
22 : mx-message-id (text)
{
author-only = true;
unique = true;
}
#
# In-Reply-To header of an imported e-mail
#
23 : mx-in-reply-to (text)
{
author-only = true;
unique = false;
}
#
# All mail headers
#