aboutsummaryrefslogtreecommitdiffstats
path: root/dist-tools/test
diff options
context:
space:
mode:
Diffstat (limited to 'dist-tools/test')
-rw-r--r--dist-tools/test/test-request20
-rwxr-xr-xdist-tools/test/testmail10
-rwxr-xr-xdist-tools/test/testmda10
-rw-r--r--dist-tools/test/testrc14
-rwxr-xr-xdist-tools/test/testservers-gen.sh57
-rw-r--r--dist-tools/test/testservers.html64
-rw-r--r--dist-tools/test/torturetest.glade976
-rw-r--r--dist-tools/test/torturetest.gladep7
-rwxr-xr-xdist-tools/test/torturetest.py326
9 files changed, 1484 insertions, 0 deletions
diff --git a/dist-tools/test/test-request b/dist-tools/test/test-request
new file mode 100644
index 00000000..160c1885
--- /dev/null
+++ b/dist-tools/test/test-request
@@ -0,0 +1,20 @@
+I maintain an open-source POP and IMAP client called fetchmail. It is
+widely used in the Linux and open-source community, and is probably
+the single most popular remote-mail client in that world. You can
+find out more about this project at
+<http://www.catb.org/~esr/fetchmail>.
+
+In order to be able to do thorough regression testing before each release,
+I collect test accounts on as many different kinds of POP3, IMAP, and
+ODMR servers as possible. Because fetchmail is strictly conformant to the
+remote-mail RFCs, many server developers have found fetchmail a useful
+standards-conformance test.
+
+I'm writing to request test accounts on your server. I support all flavors
+of POP2, POP3, IMAP and ODMR with either plain-password, CRAM-MD5, NTLM,
+GSSAPI, or Kerberos authentication. I also support SSL/TLS.
+
+It would be very helpful if I could have a separate test account for
+each protocol you support (that is, separate POP3, IMAP, and ODMR
+accounts) so I can do automated regression testing without worrying
+about mailbox race conditions.
diff --git a/dist-tools/test/testmail b/dist-tools/test/testmail
new file mode 100755
index 00000000..7941892e
--- /dev/null
+++ b/dist-tools/test/testmail
@@ -0,0 +1,10 @@
+#!/bin/sh
+size=${1:-0}
+
+(
+echo "This mail was generated on "`date`"."
+
+) | mail -s "${size}k test mail from process $$" esr@ccil.org
+
+ <<EOF
+EOF
diff --git a/dist-tools/test/testmda b/dist-tools/test/testmda
new file mode 100755
index 00000000..98a7c760
--- /dev/null
+++ b/dist-tools/test/testmda
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Test MDA for debugging fetchmail configurations.
+echo "[testmda called with the following arguments: $*]"
+
+# Display the input
+cat >/tmp/testmda$$
+echo "[text is "`wc -c </tmp/testmda$$`" bytes long]"
+cat /tmp/testmda$$
+rm /tmp/testmda$$
+
diff --git a/dist-tools/test/testrc b/dist-tools/test/testrc
new file mode 100644
index 00000000..7520f8d4
--- /dev/null
+++ b/dist-tools/test/testrc
@@ -0,0 +1,14 @@
+# Configuration created Thu Oct 23 20:13:55 2003 by fetchmailconf
+set syslog
+set postmaster "postmaster"
+set bouncemail
+set no spambounce
+set properties ""
+poll pop.whosey.net with proto POP3
+ user 'foo' there with password '*' is 'me' here
+ user 'bar' there with password '*' is 'her' here
+ user 'baz' there with password '*' is 'that' here
+
+poll mail.whatsey.ca with proto POP3 interval 60
+ user 'nimble' there with password '*' is 'her' here
+
diff --git a/dist-tools/test/testservers-gen.sh b/dist-tools/test/testservers-gen.sh
new file mode 100755
index 00000000..52a1e589
--- /dev/null
+++ b/dist-tools/test/testservers-gen.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+date=`date`
+cat <<EOF
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rev=made href="mailto:esr@snark.thyrsus.com"/>
+<meta name="description" content=""/>
+<meta name="keywords" content=""/>
+<title>Fetchmail's Test List</title>
+</head>
+<body>
+<table width="100%" cellpadding=0 summary="Canned page header"><tr>
+<td width="30%">Back to <a href="/~esr">Eric's Home Page</a>
+<td width="30%" align=center>Up to <a href="/~esr/sitemap.html">Site Map</a>
+<td width="30%" align=right>${date}
+</tr></table>
+<hr />
+<h1>Fetchmail's Test List</h1>
+
+<p>Here are the server types on my regression-test list:</p>
+
+<table border=1 width=80% align=center summary="Server list">
+<tr>
+<td><strong>Protocol &amp; Version:</strong></td>
+<td><strong>Special Options:</strong></td>
+</tr>
+EOF
+torturetest.py -t
+cat <<EOF
+</tr></table>
+
+<p>If you control a post-office server that is not one of the types listed
+here, please consider lending me a test account. Note that I do <em>not</em>
+need shell access, just the permissions to send mail to a mailbox the server
+looks at and to fetch mail off of it.</p>
+
+<p>I'd like to have weird things like a POP2 server on here. Also more
+closed-source servers because they tend to be broken in odd
+ways. These are the real robustness tests.</p>
+
+<hr />
+<table width="100%" cellpadding=0 summary="Canned page header"><tr>
+<td width="30%">Back to <a href="/~esr">Eric's Home Page</a>
+<td width="30%" align=center>Up to <a href="/~esr/sitemap.html">Site Map</a>
+<td width="30%" align=right>${date}
+</tr></table>
+
+<br clear="left" />
+<ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@thyrsus.com&gt;</A></ADDRESS>
+</BODY>
+</HTML>
+EOF
+
diff --git a/dist-tools/test/testservers.html b/dist-tools/test/testservers.html
new file mode 100644
index 00000000..62dc9e7b
--- /dev/null
+++ b/dist-tools/test/testservers.html
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rev=made href="mailto:esr@snark.thyrsus.com"/>
+<meta name="description" content=""/>
+<meta name="keywords" content=""/>
+<title>Fetchmail's Test List</title>
+</head>
+<body>
+<table width="100%" cellpadding=0 summary="Canned page header"><tr>
+<td width="30%">Back to <a href="/~esr">Eric's Home Page</a>
+<td width="30%" align=center>Up to <a href="/~esr/sitemap.html">Site Map</a>
+<td width="30%" align=right>Mon Jan 12 15:52:14 EST 2004
+</tr></table>
+<hr />
+<h1>Fetchmail's Test List</h1>
+
+<p>Here are the server types on my regression-test list:</p>
+
+<table border=1 width=80% align=center summary="Server list">
+<tr>
+<td><strong>Protocol &amp; Version:</strong></td>
+<td><strong>Special Options:</strong></td>
+</tr>
+<tr><td>IMAP: CommuniGate IMAP server</td><td>IMAPrev1 STARTTLS AUTH=CRAM-MD5 AUTH=DIGEST-MD5</td>
+<tr><td>POP3: CommuniGate POP3 server</td><td>CAPA LAST APOP CRAM-MD5</td>
+<tr><td>POP3: IntraStore POP3 mail server</td><td>!CAPA LAST</td>
+<tr><td>APOP: IntraStore POP3 mail server</td><td>!CAPA LAST APOP</td>
+<tr><td>IMAP: IntraStore IMAP mail server</td><td>IMAPrev1 IDLE AUTH=CRAM-MD5 AUTH=SKEY AUTH=ANONYMOUS</td>
+<tr><td>POP3: Eudora EIMS</td><td>CAPA LAST APOP SASL CRAM-MD5 NTLM</td>
+<tr><td>POP3: gmx.de pop server</td><td>!CAPA UIDL</td>
+<tr><td>IMAP: IMail IMAP server</td><td>IMAP4rev1 AUTH=CRAM-MD5</td>
+<tr><td>IMAP: Microsoft Exchange</td><td>IDLE AUTH=NTLM</td>
+<tr><td>POP3: qpopper 3.1.2 (Eudora) patched with mysql</td><td>CAPA UIDL</td>
+<tr><td>IMAP: Courier IMAP</td><td>IMAP4rev1</td>
+<tr><td>POP3: Courier POP3</td><td>CAPA UIDL</td>
+<tr><td>APOP: Qpopper using APOP</td><td>!CAPA</td>
+<tr><td>IMAP: UW IMAP</td><td>IMAPrev1</td>
+<tr><td>IMAP: Courier IMAP</td><td>IMAP4rev1</td>
+<tr><td>POP3: Qpopper 4.0.5</td><td>CAPA UIDL</td>
+</tr></table>
+
+<p>If you control a post-office server that is not one of the types listed
+here, please consider lending me a test account. Note that I do <em>not</em>
+need shell access, just the permissions to send mail to a mailbox the server
+looks at and to fetch mail off of it.</p>
+
+<p>I'd like to have weird things like a POP2 server on here. Also more
+closed-source servers because they tend to be broken in odd
+ways. These are the real robustness tests.</p>
+
+<hr />
+<table width="100%" cellpadding=0 summary="Canned page header"><tr>
+<td width="30%">Back to <a href="/~esr">Eric's Home Page</a>
+<td width="30%" align=center>Up to <a href="/~esr/sitemap.html">Site Map</a>
+<td width="30%" align=right>Mon Jan 12 15:52:14 EST 2004
+</tr></table>
+
+<br clear="left" />
+<ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com">&lt;esr@thyrsus.com&gt;</A></ADDRESS>
+</BODY>
+</HTML>
diff --git a/dist-tools/test/torturetest.glade b/dist-tools/test/torturetest.glade
new file mode 100644
index 00000000..d2cf07ee
--- /dev/null
+++ b/dist-tools/test/torturetest.glade
@@ -0,0 +1,976 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="torturetest">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">torturetest</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <signal name="destroy" handler="on_torturetest_destroy" last_modification_time="Wed, 16 Jul 2003 18:21:37 GMT"/>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="sitelabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Site select: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="combo1">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="entry2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ <signal name="activate" handler="on_combo_entry1_activate" last_modification_time="Wed, 16 Jul 2003 18:48:10 GMT"/>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="list1">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator2">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">9</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">0</property>
+ <property name="column_spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Sitename: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Mail Address: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Username:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Password: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="mailaddr_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="username_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="comment_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="recognition_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="capabilities_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="options_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Comment:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Recognition: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Capabilities:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Options: </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Protocol:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="host_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="POP3_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">POP3</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="APOP_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">APOP</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">POP3_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="IMAP_radiobutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">IMAP</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">POP3_radiobutton</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVSeparator" id="vseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="ssl_checkbox">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">SSL</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="updatebutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="on_updatebutton_clicked" last_modification_time="Wed, 16 Jul 2003 23:17:30 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Update</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="newbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="on_newbutton_clicked" last_modification_time="Wed, 16 Jul 2003 20:28:12 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-new</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">New</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="testbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="on_testbutton_clicked" last_modification_time="Wed, 16 Jul 2003 20:28:23 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-execute</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Test</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="quitbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="on_quitbutton_clicked" last_modification_time="Wed, 16 Jul 2003 20:08:46 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-quit</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Quit</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="dumpbutton">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <signal name="clicked" handler="on_dumpbutton_clicked" last_modification_time="Wed, 16 Jul 2003 23:34:47 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-print</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Dump</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/dist-tools/test/torturetest.gladep b/dist-tools/test/torturetest.gladep
new file mode 100644
index 00000000..d44797c3
--- /dev/null
+++ b/dist-tools/test/torturetest.gladep
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
+
+<glade-project>
+ <name>torturetest</name>
+ <program_name>torturetest</program_name>
+</glade-project>
diff --git a/dist-tools/test/torturetest.py b/dist-tools/test/torturetest.py
new file mode 100755
index 00000000..f8a3535c
--- /dev/null
+++ b/dist-tools/test/torturetest.py
@@ -0,0 +1,326 @@
+#!/usr/bin/env python2
+
+import sys, getopt, os, smtplib, commands, time, gtk, gtk.glade
+
+protocols = ('POP3', 'APOP', 'IMAP',)
+
+class TestSite:
+ temp = "/usr/tmp/torturestest-%d" % os.getpid()
+
+ def __init__(self, line=None):
+ "Initialize site data from the external representation."
+ self.host = ""
+ self.mailaddr = ""
+ self.username = ""
+ self.password = ""
+ self.protocol = ""
+ self.ssl = ""
+ self.options = ""
+ self.capabilities = ""
+ self.recognition = ""
+ self.comment = ""
+ if line:
+ (self.host, self.mailaddr, self.username, self.password, \
+ self.protocol, self.ssl, self.options, self.capabilities, \
+ self.recognition, self.comment) = \
+ line.strip().split(":")
+ if not self.mailaddr:
+ self.mailaddr = self.username
+ # Test results
+ self.status = None
+ self.output = None
+
+ def allattrs(self):
+ "Return a tuple consisting of all this site's attributes."
+ return (self.host, self.mailaddr, self.username, self.password, \
+ self.protocol, self.ssl, self.options, self.capabilities, \
+ self.recognition, self.comment)
+
+ def __repr__(self):
+ "Return the external representation of this site's data."
+ return ":".join(self.allattrs())
+
+ def prettyprint(self):
+ "Prettyprint a site entry in human-readable form."
+ return "Host: %s\n" \
+ "Mail To: %s\n" \
+ "Username: %s\n" \
+ "Password: %s\n" \
+ "Protocol: %s\n" \
+ "SSL: %s\n" \
+ "Options: %s\n" \
+ "Capabilities: %s\n" \
+ "Recognition: %s\n" \
+ "Comment: %s\n" \
+ % self.allattrs()
+
+ def entryprint(self):
+ "Print a .fetchmailrc entry corresponding to a site entry."
+ rep = "poll %s-%s via %s with proto %s %s\n" \
+ " user %s there with password '%s' is esr here" \
+ % (self.host,self.protocol,self.host,self.protocol,self.options,self.username,self.password)
+ if self.ssl and self.ssl != 'False':
+ rep += " options ssl"
+ rep += "\n\n"
+ return rep
+
+ def tableprint(self):
+ "Print an HTML server-type table entry."
+ return "<tr><td>%s: %s</td><td>%s</td>\n" \
+ % (self.protocol, self.comment, self.capabilities)
+
+ def id(self):
+ "Identify this site."
+ rep = "%s %s at %s" % (self.protocol, self.recognition, self.host)
+ if self.capabilities:
+ rep += " (" + self.capabilities + ")"
+ if self.options:
+ rep += " using " + self.options
+ return rep
+
+ def testmail(self, n=None):
+ "Send test mail to the site."
+ server = smtplib.SMTP("localhost")
+ fromaddr = "esr@thyrsus.com"
+ if self.mailaddr.find("@") > -1:
+ toaddr = self.mailaddr
+ else:
+ toaddr = "%s@%s" % (self.mailaddr, self.host)
+ msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, toaddr))
+ if n != None:
+ msg += `n` + ": "
+ msg += "Test mail collected from %s.\n" % (self.id(),)
+ server.sendmail(fromaddr, toaddr, msg)
+ server.quit()
+
+ def fetch(self, logfile=False):
+ "Run a mail fetch on this site."
+ try:
+ ofp = open(TestSite.temp, "w")
+ if logfile:
+ mda = "(echo; echo \'From torturetest\' `date`;cat) >>TEST.LOG"
+ else:
+ mda = 'cat'
+ ofp.write('defaults mda "%s"\n' % mda)
+ ofp.write(self.entryprint())
+ ofp.close()
+ (self.status, self.output) = commands.getstatusoutput("fetchmail -d0 -v -f - <%s"%TestSite.temp)
+ if self.status:
+ os.system("cat " + TestSite.temp)
+ finally:
+ os.remove(TestSite.temp)
+
+ def failed(self):
+ "Did we have a test failure here?"
+ return os.WIFEXITED(self.status) and os.WEXITSTATUS(self.status) > 1
+
+ def explain(self):
+ "Explain the status of the last test."
+ if not os.WIFEXITED(self.status):
+ return self.id() + ": abnormal termination\n"
+ elif os.WEXITSTATUS(self.status) > 1:
+ return self.id() + ": %d\n" % os.WEXITSTATUS(self.status) + self.output
+ else:
+ return self.id() + ": succeeded\n"
+
+class TortureGUI:
+ "Torturetest editing GUI,"
+
+ # All site parameters except protocol
+ field_map = ('host', 'mailaddr', 'username', 'password', \
+ 'options', 'capabilities', 'recognition', 'comment')
+
+ def __init__(self):
+ # Build the widget tree from the glade XML file.
+ self.wtree = gtk.glade.XML("torturetest.glade")
+ # File in initial values
+ self.combo = self.wtree.get_widget("combo1")
+ self.combo.set_popdown_strings(map(lambda x: x.comment, sitelist))
+ self.sslcheck = self.wtree.get_widget("ssl_checkbox")
+ self.site = sitelist[0]
+ self.display(self.site)
+
+ # Provide handlers for the widget tree's events
+ mydict = {}
+ for key in ('on_torturetest_destroy',
+ 'on_updatebutton_clicked',
+ 'on_newbutton_clicked',
+ 'on_testbutton_clicked',
+ 'on_quitbutton_clicked',
+ 'on_dumpbutton_clicked',
+ 'on_combo_entry1_activate'):
+ mydict[key] = getattr(self, key)
+ self.wtree.signal_autoconnect(mydict)
+
+ gtk.mainloop()
+ print `self.site`
+
+ def get_widget(self, widget):
+ "Get the value of a widget's contents."
+ if type(widget) == type(""):
+ widget = self.wtree.get_widget(widget)
+ if type(widget) == gtk.Entry:
+ return widget.get_text()
+ #elif type(widget) == gtk.SpinButton:
+ # return widget.get_value()
+ #elif type(widget) == gtk.TextView:
+ # return widget.get_buffer().get_text()
+
+ def set_widget(self, name, exp):
+ "Set the value of a widget by name."
+ widget = self.wtree.get_widget(name)
+ if type(widget) == gtk.Entry:
+ widget.set_text(exp)
+ elif type(widget) == gtk.SpinButton:
+ widget.set_value(exp)
+ elif type(widget) == gtk.TextView:
+ if not widget.get_buffer():
+ widget.set_buffer(gtk.TextBuffer())
+ widget.get_buffer().set_text(exp)
+
+ def display(self, site):
+ for member in TortureGUI.field_map:
+ self.set_widget(member + "_entry", getattr(site, member))
+ for proto in protocols:
+ self.wtree.get_widget(proto + "_radiobutton").set_active(site.protocol == proto)
+ self.sslcheck.set_active(int(site.ssl != '' and site.ssl != 'False'))
+ self.combo.entry.set_text(site.comment)
+
+ def update(self, site):
+ for member in TortureGUI.field_map:
+ setattr(site, member, self.get_widget(member + "_entry"))
+ for proto in protocols:
+ if self.wtree.get_widget(proto + "_radiobutton").get_active():
+ site.protocol = proto
+ if self.wtree.get_widget("ssl_checkbox").get_active():
+ site.ssl = "True"
+ else:
+ site.ssl = "False"
+
+ # Housekeeping
+ def on_torturetest_destroy(self, obj):
+ gtk.mainquit()
+ def on_updatebutton_clicked(self, obj):
+ self.update(self.site)
+ print self.site
+ if self.site.comment:
+ self.combo.entry.set_text(self.site.comment)
+ else:
+ self.combo.entry.set_text(self.site.host)
+ def on_newbutton_clicked(self, obj):
+ global sitelist
+ sitelist = [TestSite()] + sitelist
+ self.site = sitelist[0]
+ self.display(self.site)
+ self.combo.entry.set_text("")
+ def on_testbutton_clicked(self, obj):
+ self.site.fetch(False)
+ print self.site.output
+ def on_quitbutton_clicked(self, obj):
+ gtk.mainquit()
+ def on_dumpbutton_clicked(self, obj):
+ print `self.site`
+
+ def on_combo_entry1_activate(self, obj):
+ key = self.combo.entry.get_text()
+ for site in sitelist:
+ if site.comment.find(key) > -1:
+ self.site = site
+ self.display(self.site)
+ break
+
+if __name__ == "__main__":
+ # Start by reading in the sitelist
+ ifp = open("testsites")
+ sitelist = []
+ linect = 0
+ while 1:
+ linect += 1
+ line = ifp.readline()
+ if not line:
+ break
+ elif line[0] in ("#", "\n"):
+ continue
+ else:
+ try:
+ sitelist.append(TestSite(line))
+ except:
+ print "Error on line %d" % linect
+ sys.exit(0)
+
+ (options, arguments) = getopt.getopt(sys.argv[1:], "dfp:tigvse")
+ verbose = 0
+ for (switch, value) in options:
+ if switch == "-d":
+ # Prettprint the sitelist
+ map(lambda x: sys.stdout.write(x.prettyprint() + "%%\n"), sitelist)
+ sys.exit(0)
+ elif switch == "-f":
+ # Dump the sitelist as a .fetchmailrc file
+ map(lambda x: sys.stdout.write(x.entryprint()), sitelist)
+ sys.exit(0)
+ elif switch == "-p":
+ # Probe a single site
+ selected = []
+ for site in sitelist:
+ if `site`.find(value) > -1:
+ selected.append(site)
+ sitelist = selected
+ # Fall through
+ elif switch == "-t":
+ # Dump the sitelist in HTML table form
+ map(lambda x: sys.stdout.write(x.tableprint()), sitelist)
+ sys.exit(0)
+ elif switch == "-i":
+ # Dump the ids of the sitelist
+ map(lambda x: sys.stdout.write(x.id() + "\n"), sitelist)
+ sys.exit(0)
+ elif switch == "-g":
+ i = 1
+ for site in sitelist:
+ print "Sending test mail to " + site.id()
+ site.testmail(i)
+ i+= 1
+ # Send test mail to each site
+ sys.stdout.write("Delaying to give the test mail time to land...")
+ time.sleep(5)
+ sys.stdout.write("here we go:\n")
+ # Fall through
+ elif switch == "-v":
+ # Display the test output
+ verbose = 1
+ elif switch == "-s":
+ # Dump recognition strings of all tested servers as a Python tuple
+ print "(" + ",\n".join(map(lambda x: repr(x.recognition), filter(lambda x: x.recognition, sitelist))) + ")"
+ sys.exit(0)
+ elif switch == "-e":
+ TortureGUI()
+ sys.exit(0)
+
+ # If no options, run the torture test
+ try:
+ failures = successes = 0
+ os.system("fetchmail -q")
+ for site in sitelist:
+ print "Testing " + site.id()
+ site.fetch(True)
+ if verbose:
+ print site.output
+ if site.failed():
+ failures += 1
+ else:
+ successes += 1
+
+ # OK, summarize results
+ print "\n%d successes and %d failures out of %d tests" \
+ % (successes, failures, len(sitelist))
+
+ if failures:
+ print "Bad status was returned on the following sites:"
+ for site in sitelist:
+ if site.failed():
+ sys.stdout.write(site.explain() + "\n")
+ except KeyboardInterrupt:
+ print "Interrupted."
+
+# end