Annotation of loncom/build/weblayer_test/test_weblayer.pl, revision 1.1

1.1     ! harris41    1: #!/usr/bin/perl
        !             2: 
        !             3: =pod
        !             4: 
        !             5: =head1 NAME
        !             6: 
        !             7: test_weblayer.pl - Test the LON-CAPA web layer by coordinating simulated web transactions
        !             8: 
        !             9: =cut
        !            10: 
        !            11: # The LearningOnline Network
        !            12: # test_weblayer.pl - Test the web layer
        !            13: #
        !            14: # $Id$
        !            15: #
        !            16: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
        !            17: #
        !            18: # LON-CAPA is free software; you can redistribute it and/or modify
        !            19: # it under the terms of the GNU General Public License as published by
        !            20: # the Free Software Foundation; either version 2 of the License, or
        !            21: # (at your option) any later version.
        !            22: #
        !            23: # LON-CAPA is distributed in the hope that it will be useful,
        !            24: # but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            25: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            26: # GNU General Public License for more details.
        !            27: #
        !            28: # You should have received a copy of the GNU General Public License
        !            29: # along with LON-CAPA; if not, write to the Free Software
        !            30: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        !            31: #
        !            32: # /home/httpd/html/adm/gpl.txt
        !            33: #
        !            34: # http://www.lon-capa.org/
        !            35: #
        !            36: # YEAR=2002
        !            37: # 3/4 Scott Harrison
        !            38: #
        !            39: ###
        !            40: 
        !            41: =pod
        !            42: 
        !            43: =head1 SYNOPSIS
        !            44: 
        !            45: B<perl test_weblayer.pl>
        !            46: 
        !            47: =head1 DESCRIPTION
        !            48: 
        !            49: This program reads in the machine's host id and domain for LON-CAPA.
        !            50: A password is randomly generated and a test user with a name beginning
        !            51: with 'ZXQTEST' is created.  A test login is run.
        !            52: 
        !            53: =cut
        !            54: 
        !            55: # ------------------------------------------------ determine host id and domain
        !            56: my %perlvar;
        !            57: open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf";
        !            58: while ($configline=<CONFIG>) {
        !            59:     if ($configline =~ /PerlSetVar/) {
        !            60: 	my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);
        !            61:         chomp($varvalue);
        !            62:         $perlvar{$varname}=$varvalue;
        !            63:     }
        !            64: }
        !            65: close(CONFIG);
        !            66: my $hostid=$perlvar{'lonHostID'};
        !            67: my $domain=$perlvar{'lonDefDomain'};
        !            68: 
        !            69: print "Testing web layer, hostid=$hostid, domain=$domain\n";
        !            70: 
        !            71: # ---------------------------------------------------------- determine password
        !            72: srand;
        !            73: my @abet=('a'..'z','A'..'Z',0..9);
        !            74: my $passwd='';
        !            75: for (my $i=0;$i<11;$i++) {
        !            76:     $passwd.=$abet[int(rand(62))];
        !            77: }
        !            78: 
        !            79: # -------------------------------------------------------------- make test user
        !            80: open OUT, "|perl make_test_user.pl ${hostid}$$ $domain" or
        !            81:     (print("**** ERROR **** cannot run make_test_user.pl\n") and exit(1));
        !            82: print OUT $passwd;
        !            83: close OUT;
        !            84: print "**** ERROR **** problems encountered with making user\n" 
        !            85:     and exit(1) if $?;
        !            86: 
        !            87: # ---------------------------------------------------------------- try to login
        !            88: open OUT, "|perl test_login.pl" or 
        !            89:     (print("**** ERROR **** cannot run test_login.pl\n") and exit(1));
        !            90: print OUT "ZXQTEST${hostid}$$\n";
        !            91: print OUT "$passwd";
        !            92: close OUT;
        !            93: print "**** ERROR **** problems encountered with testing login\n"
        !            94:     and exit(1) if $?;
        !            95: 
        !            96: # ---------------------------------------------------------- clean up test user
        !            97: `rm -Rf /home/httpd/lonUsers/$domain/Z/X/Q/ZXQTEST${hostid}*`;
        !            98: 
        !            99: =pod
        !           100: 
        !           101: =head1 AUTHOR
        !           102: 
        !           103: Scott Harrison, harris41@msu.edu
        !           104: 
        !           105: =cut

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>