add OpenID logo and a little styling to the login forms
[scpubgit/stemmatology.git] / t / bin / update-load-test.pl
CommitLineData
fc7b6388 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use lib 'lib';
7
8use File::Temp;
9
10use Text::Tradition;
11use Text::Tradition::Directory;
12
13## We're loading the besoin data, and dumping the backend db rows into
14## a .sql file for load testing (testing of data loading, not the
15## other sort)
16my $sql = 't/data/speed_test_load.sql';
17my $uuid = 'load-test';
18
19print "Loading t/data/besoin.xml and storing it in $sql ...\n";
20
21## Load tradition data:
22my $tradition = Text::Tradition->new(
23 'input' => 'Self',
24 'file' => "t/data/besoin.xml"
25);
26$tradition->add_stemma(dotfile => "t/data/besoin.dot");
27
28## save to db:
29my $fh = File::Temp->new();
30my $file = $fh->filename;
31$fh->close;
32
33my $dsn = "dbi:SQLite:$file";
34my $dir = Text::Tradition::Directory->new(
35 dsn => $dsn,
36 extra_args => { create => 1 },
37);
38my $scope = $dir->new_scope;
39$dir->store($uuid, $tradition);
40
41## out to SQL file:
42`sqlite3 $file ".dump" > $sql`;
43
44print "$sql updated,\n";
45
46=head1 NAME
47
48update-load-test.pl - Recreate the test file using for testing the speed of loading Traditions from a KiokuDB.
49
50=head1 USAGE
51
52 perl t/bin/update-load-test.pl
53
54This small script exists to enable an update of the test data for the
55speed tests in F<t/data/load-save-speed.t>. It loads the
56F<t/data/besoin.xml> test file and outputs the resulting database to
57F<t/data/speed_test_load.sql>.
58
59Only run this script after changes have been made to the way
60Traditions data is stored in the database.
61
62