+2005-05-30 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/test/Makefile.in: Add LDFLAGS variable for profiling purposes.
+
+ * ircd/test/ircd_match_t.c: Test recovery from backtracking.
+
+ * ircd/test/channel-1.cmd: Modify to improve code coverage.
+
+ * ircd/test/client-1.cmd: Likewise.
+
+ * ircd/test/gline-1.cmd: Likewise.
+
+ * ircd/test/ircd-t1.conf: Likewise.
+
+ * ircd/test/stats-1.cmd: Likewise.
+
+ * ircd/test/run-tests.sh: Explicitly start ircds. Add new test scripts.
+
+ * ircd/test/test-driver.pl: Silently handle more signals from IRC.
+
+ * ircd/test/commands-1.cmd: New test script.
+
+ * ircd/test/feature-1.cmd: New test script.
+
+ * ircd/test/jupe-1.cmd: New test script.
+
+ * ircd/test/kill-block-1.cmd: New test script.
+
+ * ircd/test/ircd-t1-2.conf: New configuration file for test scripts.
+
+ * ircd/test/ircd-t2.conf: Likewise.
+
2005-05-30 Michael Poole <mdpoole@troilus.org>
* ircd/s_debug.c (count_memory): Use count_listener_memory() to
VPATH = @srcdir@
CPPFLAGS = -I${top_srcdir}/include -I../..
CFLAGS = -g -Wall
+LDFLAGS =
CC = @CC@
TESTPROGS = \
IRCD_CHATTR_T_OBJS = ircd_chattr_t.o test_stub.o ../ircd_string.o
ircd_chattr_t: $(IRCD_CHATTR_T_OBJS)
- ${CC} -o $@ $(IRCD_CHATTR_T_OBJS)
+ ${CC} -o $@ $(LDFLAGS) $(IRCD_CHATTR_T_OBJS)
IRCD_IN_ADDR_T_OBJS = ircd_in_addr_t.o test_stub.o ../ircd_alloc.o ../ircd_string.o ../match.o ../numnicks.o
ircd_in_addr_t: $(IRCD_IN_ADDR_T_OBJS)
- ${CC} -o $@ $(IRCD_IN_ADDR_T_OBJS)
+ ${CC} -o $@ $(LDFLAGS) $(IRCD_IN_ADDR_T_OBJS)
IRCD_MATCH_T_OBJS = ircd_match_t.o test_stub.o ../ircd_string.o ../match.o
ircd_match_t: $(IRCD_MATCH_T_OBJS)
- ${CC} -o $@ $(IRCD_MATCH_T_OBJS)
+ ${CC} -o $@ $(LDFLAGS) $(IRCD_MATCH_T_OBJS)
IRCD_STRING_T_OBJS = ircd_string_t.o test_stub.o ../ircd_string.o
ircd_string_t: $(IRCD_STRING_T_OBJS)
- ${CC} -o $@ $(IRCD_STRING_T_OBJS)
+ ${CC} -o $@ $(LDFLAGS) $(IRCD_STRING_T_OBJS)
.c.o:
${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
-define srv localhost:7701
+define srv localhost
-connect cl1 Alex alex %srv% :Test client 1
-connect cl2 Bubb bubb %srv% :Test client 2
+connect cl1 Alex alex %srv%:7701 :Test client 1
+connect cl2 Bubb bubb %srv%:7711 :Test client 2
:cl1 join #test
:cl1 join #test2
:cl1 mode #test +bb *!*@127.0.0.1 *!*@127.0.0.2
:cl2 wait cl1
-:cl2 join #test
+:cl2 raw :away :I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away. I'm not here, go away.
+:cl2 raw :away :I'm not here, go away.
+:cl2 join #test,#test3,#test4,+local
:cl1 wait cl2
+:cl1 join #test3
+:cl1 raw :invite Bubb
+:cl1 raw :invite #test
+:cl1 invite Bubb #non-existent-channel
+:cl1 invite Bubb #test3
+:cl1 invite Bubb #test4
:cl1 invite Bubb #test
:cl2 expect *cl1 invite #test
+:cl2 mode #test3 +o Alex
+:cl2 raw :invite
:cl2 join #test
:cl2 privmsg #test :Hello, *cl1.
+:cl2 notice #test :Hello, *cl1 (via notice).
+:cl2 notice @#test :Hello, *cl1 (via wallchops).
+:cl2 privmsg #test5 :Hello, *cl1.
:cl2 nick Buba
:cl2 mode #test +l 15
:cl1 wait cl2
:cl1 privmsg #test :Hello, *cl2.
+:cl1 raw :cprivmsg bubb #test :Hello, bubb.
+:cl1 raw :cnotice bubb #test :Hello, bubb.
:cl1 mode #test -b+kv *!*@127.0.0.1 secret Bubb
:cl1 mode #test +b foo!bar@baz
:cl1 mode #test +b
:cl1 mode #test :
:cl1 mode #test
-:cl1 raw who #test %lfuh
+:cl1 raw :names
+:cl1 raw :names #test
+:cl1 raw :names +local
+:cl1 raw :names +local test-2.*
+:cl1 raw :who #test %lfuh
:cl2 wait cl1
+:cl2 raw :part
:cl2 part #test
+:cl2 part #test5
:cl1 wait cl2
:cl2 join #test public
:cl2 join #test secret
:cl2 wait cl1
:cl2 mode #test2 -D
:cl2 mode #test +v Alex
+:cl1 raw :kick #test bubb
+:cl2 raw :squit test-1.*
+:cl2 sleep 1
+:cl2 raw :connect test-1.*
+:cl2 raw :away :
:cl1 wait cl2
-define srv localhost:7701
+define srv localhost
-connect cl1 Alex alex %srv% :Test client 1
+connect cl1 Alex alex %srv%:7701 :Test client 1
:cl1 oper oper1 oper1
-connect cl2 Bubb bubb %srv% :Test client 2
+:cl1 oper oper1 oper1
+connect cl2 Bubb bubb %srv%:7711 :Test client 2
+:cl1 raw :time
:cl2 oper oper3 oper4
+:cl1 raw :version
:cl2 oper oldoper wrongpass
:cl2 oper md5oper wrongpass
:cl2 oper cryptoper wrongpass
:cl1 raw :privs Bubb
:cl1 nick A
:cl1 nick Alexey
+:cl1 raw :privmsg :
+:cl1 raw :privmsg Alexey :
+:cl1 raw :privmsg Bubb :hello Bubb
+:cl1 raw :privmsg $*.net :Hello all *.net servers.
+:cl1 raw :notice $*.net :Hello all *.net servers.
+:cl1 raw :kill Bubb :goodbye Bubb
+:cl1 raw :whowas Alex,Bubb 5
--- /dev/null
+define srv localhost:7701
+
+connect cl1 Alex alex %srv% :Test client 1
+connect cl2 Bubb bubb %srv% :Test client 2
+:cl1 raw :help
+:cl1 raw :admin
+:cl1 raw :admin test-2.*
+:cl1 raw :info
+:cl1 raw :wallops :HELLO OPERZ!!!
+:cl1 wait cl2
+:cl1 raw :ison alex,bubb,alex,bubb,alex,bubb
+:cl1 raw :who b*b
+:cl1 raw :burst the bubble
+:cl1 raw :server huh huh i'm a server
+:cl1 raw :links
+:cl1 raw :map
+:cl1 raw :nick
+:cl1 raw :nick ~
+:cl1 raw :nick -dude-
+:cl1 raw :nick alex
+:cl1 raw :nick Bubb
+:cl1 raw :ping alex test-1.*
+
+:cl1 oper oper1 oper1
+:cl1 raw :admin
+:cl1 raw :admin test-2.*
+:cl1 raw :asll
+:cl1 raw :asll test-2.*
+:cl1 raw :info
+:cl1 raw :info test-2.*
+:cl1 raw :who x b*b
+:cl1 raw :close
+:cl1 raw :map
+:cl1 raw :links
+:cl1 raw :links test-2.*
+:cl1 raw :lusers
+:cl1 raw :lusers test-2.*
+:cl1 raw :motd
+:cl1 raw :motd test-2.*
+:cl1 raw :ping alex test-2.*
+:cl1 raw :rping test-2.*
+
+:cl2 raw :quit
--- /dev/null
+define srv localhost:7701
+
+connect cl1 Alex alex %srv% :Test client 1
+:cl1 oper oper1 oper1
+:cl1 raw :GET LOG
+:cl1 raw :RESET LOG
+:cl1 raw :GET RANDOM_SEED
+:cl1 raw :SET RANDOM_SEED
+:cl1 raw :SET RANDOM_SEED abcdefghijklmnop
+:cl1 raw :GET DEFAULT_LIST_PARAM
+:cl1 raw :SET DEFAULT_LIST_PARAM FALSE
+:cl1 raw :SET DEFAULT_LIST_PARAM TRUE
+:cl1 nick Alexey
+:cl1 nick Amdahl
+:cl1 nick Andy
+:cl1 nick Aon
+:cl1 nick Apple
+:cl1 raw :SET NICKNAMEHISTORYLENGTH 4
:cl1 raw :gline !+127.2.* 3600 :Localclone?
:cl1 sleep 5
:cl1 raw :gline !+127.2.* 3600 :Localclone?
+:cl1 raw :gline !+127.2.*/15 3600 :Localclone?
+:cl1 raw :gline !+127.2.0.0/33 3600 :Localclone?
+:cl1 raw :gline !+127.2.0.0/15 3600 :Localclone?
connect cl2 Bubb bubb %srv% :Test client 2
:cl1 raw :gline
:cl1 raw :gline $Rbubb
--- /dev/null
+General {
+ name = "test-1.example.net";
+ vhost = "127.0.0.1";
+ vhost = "::1";
+ description = "Test Server 1";
+ numeric = 1;
+};
+
+Admin {
+ location = "Somewhere";
+ contact = "Someone";
+};
+
+Class {
+ name = "Server";
+ pingfreq = 180 seconds;
+ connectfreq = 300 seconds;
+ maxlinks = 1;
+ sendq = 9000000;
+};
+
+Class {
+ name = "others";
+ pingfreq = 180 seconds;
+ sendq = 160000;
+ maxlinks = 100;
+ usermode = "+oiwx";
+};
+
+Class {
+ name = "Opers";
+ pingfreq = 180 seconds;
+ sendq = 160000;
+ maxlinks = 10;
+ local = no;
+};
+
+Connect {
+ name = "bogus.example.net";
+ host = "example.net";
+ password = "bogus_example";
+ port = 7700;
+ class = "Server";
+ maxhops = 2;
+ hub = "*.example.net";
+ autoconnect = yes; # forces a DNS resolution attempt
+};
+
+CRule {
+ server = "bogus.example.net";
+ all = yes;
+ rule = "connected(*)";
+};
+
+CRule {
+ server = "bogus.example.net";
+ all = no;
+ rule = "directcon(*)";
+};
+
+UWorld {
+ name = "uworld.example.net";
+ name = "uworld2.example.net";
+};
+
+Jupe {
+ nick = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q";
+ nick = "R,S,T,U,V,W,X,Y,Z,{,|,},~,-,_,`";
+};
+
+Operator { name = "oper1"; host = "*@*"; password = "$PLAIN$oper1"; class = "Opers"; };
+Operator { name = "oper2"; host = "*@*"; password = "$PLAIN$oper2"; class = "Opers"; local = yes; };
+Operator { name = "oldoper"; host = "*@*"; password = "Xlfc26b4eYGWs"; class = "Opers"; };
+Operator { name = "md5oper"; host = "*@*"; password = "$SMD5$2O$4O.rSAmhE4Fg05MmG.047/"; class = "Opers"; };
+Operator { name = "cryptoper"; host = "*@*"; password = "$CRYPT$41ndrxPQu3B66"; class = "Opers"; };
+
+Kill { username = "sub7"; realname = "s*7*"; reason = "You are infected with a Trojan"; };
+Kill { realname = "Chloe"; reason = "drones"; };
+Kill { username = "sub7"; reason = "You are infected with a Trojan"; };
+
+Client { class = "others"; ip = "*"; };
+
+Port { server = yes; port = 7700; };
+Port { server = no; port = 7702; };
+
+Quarantine {
+ "#shells" = "Thou shalt not support the h4><0rz";
+};
+
+Features {
+ "HIS_STATS_k" = "FALSE";
+ "PPATH" = "ircd-t1.pid";
+};
autoconnect = yes; # forces a DNS resolution attempt
};
+Connect {
+ name = "test-2.example.net";
+ host = "::1";
+ password = "bogus_example";
+ port = 7710;
+ class = "Server";
+ autoconnect = no;
+};
+
CRule {
server = "bogus.example.net";
all = yes;
Features {
"HIS_STATS_k" = "FALSE";
+ "PPATH" = "ircd-t1.pid";
};
--- /dev/null
+General {
+ name = "test-2.example.net";
+ vhost = "127.0.0.1";
+ vhost = "::1";
+ description = "Test Server 2";
+ numeric = 2;
+};
+
+Admin {
+ location = "Somewhere";
+ contact = "Someone";
+};
+
+Class {
+ name = "Server";
+ pingfreq = 180 seconds;
+ connectfreq = 300 seconds;
+ maxlinks = 1;
+ sendq = 9000000;
+};
+
+Class {
+ name = "others";
+ pingfreq = 180 seconds;
+ sendq = 160000;
+ maxlinks = 100;
+ usermode = "+oiwx";
+};
+
+Class {
+ name = "Opers";
+ pingfreq = 180 seconds;
+ sendq = 160000;
+ maxlinks = 10;
+ local = no;
+};
+
+Connect {
+ name = "test-1.example.net";
+ host = "::1";
+ password = "bogus_example";
+ port = 7700;
+ class = "Server";
+ maxhops = 2;
+ hub = "*.example.net";
+ autoconnect = yes;
+};
+
+CRule {
+ server = "bogus.example.net";
+ all = yes;
+ rule = "connected(*)";
+};
+
+CRule {
+ server = "bogus.example.net";
+ all = no;
+ rule = "directcon(*)";
+};
+
+UWorld {
+ name = "uworld.example.net";
+ name = "uworld2.example.net";
+};
+
+Jupe {
+ nick = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q";
+ nick = "R,S,T,U,V,W,X,Y,Z,{,|,},~,-,_,`";
+};
+
+Operator { name = "oper1"; host = "*@*"; password = "$PLAIN$oper1"; class = "Opers"; };
+Operator { name = "oper2"; host = "*@*"; password = "$PLAIN$oper2"; class = "Opers"; local = yes; };
+
+Kill { realname = "Chloe"; reason = "drones"; };
+Kill { username = "sub7"; reason = "You are infected with a Trojan"; };
+
+Client { class = "others"; ip = "*"; };
+
+Port { server = yes; port = 7710; };
+Port { server = no; port = 7711; mask = "127.0.0.0/8"; };
+
+Quarantine {
+ "#shells" = "Thou shalt not support the h4><0rz";
+};
+
+Pseudo "X" {
+ name = "X";
+ nick = "X@channels.example.net";
+};
+
+Features {
+ "PPATH" = "ircd-t2.pid";
+ "LOG" = "SYSTEM" "FILE" "ircd-t2.log";
+ "LOG" = "SYSTEM" "LEVEL" "NOTICE";
+};
"abc\0",
"abcd\0cabc\0" },
{ "*abc",
- "abc\0fooabc\0",
+ "abc\0fooabc\0ababc\0",
"abra\0abcd\0" },
{ "\\?",
"?\0",
--- /dev/null
+define srv localhost:7701
+
+connect cl1 Alex alex %srv% :Test client 1
+:cl1 oper oper1 oper1
+:cl1 raw :jupe +irc-3.example.net 3600 :Server 3 not welcome here.
+:cl1 raw :jupe -irc-3.example.net 3600 :Server 3 not welcome here.
+:cl1 raw :jupe +irc-3.example.net * 3600 :Server 3 not welcome here.
+:cl1 raw :jupe -irc-3.example.net * 3600 :Server 3 not welcome here.
--- /dev/null
+define srv localhost:7701
+
+connect cl1 Alex sub7 %srv% :s7server
+connect cl2 Chloe chloe %srv% :Chloe
#! /bin/sh
set -e
srcdir=$1
-for script in channel-1 client-1 stats-1 gline-1 ; do
+cp ${srcdir}/ircd-t1.conf ircd-t1.conf
+cp ${srcdir}/ircd-t2.conf ircd-t2.conf
+echo "Testing one-shot ircd invocations."
+../ircd -v
+../ircd -x 6 -k -d . -f ircd-t1.conf -c user@127.0.0.1
+echo "Starting ircd."
+../ircd -d . -f ircd-t1.conf
+../ircd -d . -f ircd-t2.conf
+sleep 10
+# stats-1 is out of alphabetical order to avoid triggering IPcheck.
+for script in channel-1 client-1 command-1 feature-1 gline-1 stats-1 jupe-1 kill-block-1 ; do
echo "Running test $script."
${srcdir}/test-driver.pl ${srcdir}/${script}.cmd
done
-echo "Terminating server."
-${srcdir}/test-driver.pl ${srcdir}/die.cmd
-../ircd -?
-../ircd -v
-../ircd -x 6 -k -d ${srcdir} -f ircd-t1.conf -c user@127.0.0.1
+echo "Sending signals to server."
+cp ${srcdir}/ircd-t1-2.conf ircd-t1.conf
+kill -HUP `cat ircd-t1.pid`
+sleep 1
+kill -INT `cat ircd-t1.pid`
+# A long sleep is necessary to make the server flush its IPcheck entries.
+sleep 610
+kill -TERM `cat ircd-t1.pid` `cat ircd-t2.pid`
+sleep 1
+../ircd -? || true
:cl1 raw :stats z
:cl1 raw :stats *
+# Remote stats requests
+:cl1 raw :stats f test-2.*
+
# Named stats commands
:cl1 raw :stats nameservers
:cl1 raw :stats connect
:cl1 raw :stats memory
:cl1 raw :stats help
:cl1 raw :hash
+:cl1 raw :rehash m
+:cl1 raw :rehash l
+:cl1 raw :rehash q
:cl1 raw :rehash
:cl1 nick Alexey
irc_nick => sub {},
irc_part => sub {},
irc_ping => sub {},
+ irc_pong => sub {},
+ irc_rpong => sub {},
irc_quit => sub {},
irc_topic => sub {},
+ irc_plugin_add => sub {},
irc_error => \&irc_error,
irc_disconnected => \&irc_disconnected,
irc_socketerr => \&irc_socketerr,
}
return undef;
}
- print "ERROR: Unexpected event $state to test driver (from ".$sender->ID.")\n";
+ print "ERROR: Unexpected event $state to test driver (from ".$sender->ID.")\n"
+ unless $state eq '_signal';
return undef;
}