Archive for October, 2008

Installing Litmus

Litmus is cool. It is a testing framework for users. It manages the test cases and test results. But it is no automatic testing.

Resources:

However, it was somehow mainly built for mozilla by mozilla, so the only really supported working version is litmus.mozilla.org. You can download and install it, but its not that easy.

I needed to install the following perl packages, most are also listed in INSTALL (I had a centos4):
yum install perl-Getopt-Long perl-Encode perl-Data-Page perl-Params-Util perl-Clone perl-version perl-Time-Piece perl-UNIVERSAL-moniker perl-XML-Parser perl-Class-Trigger perl-Class-DBI perl-HTML-Strip perl-JSON-XS perl-Test-Harness perl-Class-DBI-Pager perl-Date-Manip perl-Class-DBI-mysql perl-Data-Dumper perl-Data-JavaScript-Anon perl-JSON perl-Time-Piece-MySQL perl-XML-XPath perl-Time-HiRes perl-Class-DBI-Plugin-RetrieveAll perl-DBD-mysql perl-DBD-MySQL perl-DBIx-ContextualFetch perl-Class-Data-Inheritable perl-Class-Accessor perl-Ima-DBI perl-Digest-SHA1 perl-Apache-DBI perl-Class-Accessor-Chained perl-Sys-Hostname-Long perl-HTML-Template perl-Text-Template perl-Text-Template-Simple perl-Apache-DBILogin perl-Email-MIME-Encodings perl-Email-Simple perl-Email-MIME-ContentType perl-Email-MIME perl-Email-Address perl-Email-MessageID perl-Module-Pluggable perl-Return-Value perl-Email-MIME-Modifier perl-Email-Send perl-Params-Validate perl-List-MoreUtils perl-DateTime-Locale perl-Class-Singleton perl-Email-Date-Format perl-DateTime perl-DateTime-Format-HTTP perl-DateTime-Format-Mail perl-DateTime-TimeZone perl-PatchReader

Maybe you need not all of those, and some are dependencies of the others, but then on the other hand, having them makes it work…

I installed those from source (CPAN) for more updated versions:
Class-DBI Data-JavaScript HTML-Parser HTML-StripScripts HTML-StripScripts-Parser JSON JSON-XS Template-Toolkit Text-Markdown

Do it like this:
/usr/bin/perl -MCPAN -e ‘install “JSON::XS”‘
CPAN is useful: http://search.cpan.org/~makamaka/JSON-2.12/lib/JSON.pm

Litmus code itself:

In populatedb.sql, you have to say edit the line USE `litmus`; if you want a different database name.

You have to edit localconfig: Important: Set $bugzilla_auth_enabled = 0;
Bugzilla-auth probably never worked.

You need to setup your Webserver to work with Perl, see some other documentation (resources above). Do what INSTALL says. The tests are outdated, 56 fail here, don’t cry.

At the end I ran into the problem that (using litespeed/lsws as a webserver) the login cookie is not set, and you are logged out all the time. Workaround: write a php script that accepts the login and sets the cookie. Suboptimal, but WFM.

EDIT: As a good open source community member, I just wrote some bug reports. With patches. Woohoo!

No Comments

Moving dokuwiki pages to another namespace

I adapted the perl code here: http://blog.doomicile.de/2008/08/11/moving-dokuwiki-pages-with-perl/

It originally moves pages according to a month/day/year scheme.

I just wanted to move all the pages to a subnamespace. Here is my script:

#!/usr/bin/perl
use strict;
use WWW::Mechanize;
use WWW::Mechanize::FormFiller;
use URI::URL;
# list with page names
my @urls = `cat liste.txt`;
my $agent = WWW::Mechanize->new( autocheck => 1 );
my $formfiller = WWW::Mechanize::FormFiller->new();
$agent->env_proxy();
print "Logging in ... \n";
$agent->get('http://myurl/wiki/doku.php?do=login');
$agent->form_number(7) if $agent->forms and scalar @{ $agent->forms };
$formfiller->add_filler( 'u' => Fixed => 'myadmin' );
$formfiller->add_filler( 'p' => Fixed => 'mypassword' );
$formfiller->fill_form( $agent->current_form );
$agent->submit();
print "Logging in done.\n";
my $n, my $o, my $p;
foreach (@urls) {
print $_;
( $n, $o ) = m/(.*):([^:]*)/;
$p = 'myprefix:';
if (length($n) == 0) {
$p = 'myprefix';
( $o ) = m/(.*)/;
}
print '=> ' . $p . '|' . $n . '|' . $o . "\n";
$agent->get( "http://myurl/wiki/doku.php?id=" . $_ . "&do=admin&page=pagemove" );
$agent->form_number(6) if $agent->forms and scalar @{ $agent->forms };
$formfiller->fill_form( $agent->current_form );
$formfiller->fill_form( $agent->current_form );
if (length($n) == 0) {
$formfiller->add_filler( 'nsr' => Fixed => '' );
$formfiller->add_filler( 'newns' => Fixed => $p );
$formfiller->add_filler( 'ns' => Fixed => $p );
} else {
$formfiller->add_filler( 'nsr' => Fixed => '<new>' );
$formfiller->add_filler( 'newns' => Fixed => $p . $n );
$formfiller->add_filler( 'ns' => Fixed => ':' );
}
$formfiller->add_filler( 'pagename' => Fixed => $o );
$formfiller->fill_form( $agent->current_form );
$agent->save_content("/tmp/mydump.txt");
$agent->submit();
$agent->save_content("/tmp/mydump-response.txt");
}

PS: Apparently, I can write perl. I did not know.

No Comments