summaryrefslogtreecommitdiffstats
path: root/t/00-perms.t
blob: 748813984394d8eea7786e509a5e7dbe1a8a46c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/perl
# msguntypot tester.

#########################

use strict;
use warnings;

use lib q(t);

use Test::More 'no_plan';
use File::Path qw(make_path remove_tree);

# No need to test uid nor to play with chmod on windows
unless ( $^O eq 'MSWin32' ) {

    BAIL_OUT("Tests cannot be run as root. Please use a regular user ID instead.\n") if $> == 0;

    my @cmds = (
        "chmod 755 t/cfg",
        "find t/add t/cfg t/charset -maxdepth 1 -type d -exec chmod 755 {} \\;",
        "find t/add t/cfg t/charset -maxdepth 2 -type d -exec chmod 755 {} \\;",
        "find t/add t/cfg t/charset             -type d -exec chmod 755 {} \\;",
        "find t                                 -type f -exec chmod 644 {} \\;"
    );

    foreach my $cmd (@cmds) {
        my $exit_status = system($cmd);
        if ( $exit_status == 0 ) {
            pass($cmd);
        } else {
            BAIL_OUT( $cmd . " (retcode: $exit_status)" );
        }
    }
}

0;