source: ProjectBuilder/devel/pb-modules/t/Base.t@ 1153

Last change on this file since 1153 was 1153, checked in by Bruno Cornec, 13 years ago
  • Avoid File::MimeInfo hard requirement. Only abort if not found when needed.
  • Improve report when a perl module is missing
  • Kill an existing crashed VM using an SSH port needed for another VM (should avoid crashed VM to stay when building for all VMs)
  • Use a new parameter vmbuildtm as a timeout before killing the VM (shoudl correspond to build + transfer time)
  • use twice the number of VMs for ports in the range for SSH communication to allow for VMs to finish in an unordered way.
  • Fix a bug in test modules when using Test simple only
  • Mail::Sendmail is now optional for Log module as well, even if not used yet
  • Update pb.conf doc with info for vmbuildtm and vmmem
  • Ready for 0.10.1
File size: 1.7 KB
Line 
1#!/usr/bin/perl -w
2#
3# Tests ProjectBuilder::Base functions
4
5use strict;
6use ProjectBuilder::Base;
7
8eval
9{
10 require Test::More;
11 Test::More->import();
12 my ($tmv,$tmsv) = split(/\./,$Test::More::VERSION);
13 if ($tmsv lt 87) {
14 die "Test::More is not available in an appropriate version ($tmsv)";
15 }
16};
17
18# Test::More appropriate version not found so no test will be performed here
19if ($@) {
20 require Test;
21 Test->import();
22 plan(tests => 1);
23 print "# Faking tests as Test::More is not available in an appropriate version\n";
24 ok(1,1);
25 exit(0);
26}
27
28my $nt = 0;
29my $test = {
30 # Full URI
31 "svn+ssh://account\@machine.sdom.tld:8080/path/to/file" => ["svn+ssh","account","machine.sdom.tld","8080","/path/to/file"],
32 # Partial URI
33 "http://machine2/path1/to/anotherfile" => ["http","","machine2","","/path1/to/anotherfile"],
34 };
35
36my ($scheme, $account, $host, $port, $path);
37foreach my $uri (keys %$test) {
38 ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
39
40 is($scheme, $test->{$uri}[0], "pb_get_uri Test protocol $uri");
41 $nt++;
42
43 is($account, $test->{$uri}[1], "pb_get_uri Test account $uri");
44 $nt++;
45
46 is($host, $test->{$uri}[2], "pb_get_uri Test host $uri");
47 $nt++;
48
49 is($port, $test->{$uri}[3], "pb_get_uri Test port $uri");
50 $nt++;
51
52 is($path, $test->{$uri}[4], "pb_get_uri Test path $uri");
53 $nt++;
54}
55
56$ENV{'TMPDIR'} = "/tmp";
57pb_temp_init();
58like($ENV{'PBTMP'}, qr|/tmp/pb\.[0-9A-z]+|, "pb_temp_init Test");
59$nt++;
60
61my $content = "This is content with TABs and spaces and \ncarriage returns\n";
62open(FILE,"> $ENV{'PBTMP'}/test") || die "Unable to create temp file";
63print FILE $content;
64close(FILE);
65
66my $cnt = pb_get_content("$ENV{'PBTMP'}/test");
67is($cnt, $content, "pb_get_content Test");
68$nt++;
69
70done_testing($nt);
Note: See TracBrowser for help on using the repository browser.