1Test::Alien::Build(3) User Contributed Perl DocumentationTest::Alien::Build(3)
2
3
4
6 Test::Alien::Build - Tools for testing Alien::Build + alienfile
7
9 version 1.55
10
12 use Test2::V0;
13 use Test::Alien::Build;
14
15 # returns an instance of Alien::Build.
16 my $build = alienfile_ok q{
17 use alienfile;
18
19 plugin 'My::Plugin' => (
20 foo => 1,
21 bar => 'string',
22 ...
23 );
24 };
25
26 alien_build_ok 'builds okay.';
27
28 done_testing;
29
31 This module provides some tools for testing Alien::Build and alienfile.
32 Outside of Alien::Build core development, It is probably most useful
33 for Alien::Build::Plugin developers.
34
35 This module also unsets a number of Alien::Build specific environment
36 variables, in order to make tests reproducible even when overrides are
37 set in different environments. So if you want to test those variables
38 in various states you should explicitly set them in your test script.
39 These variables are unset if they defined: "ALIEN_BUILD_PRELOAD"
40 "ALIEN_BUILD_POSTLOAD" "ALIEN_INSTALL_TYPE".
41
43 alienfile
44 my $build = alienfile;
45 my $build = alienfile q{ use alienfile ... };
46 my $build = alienfile filename => 'alienfile';
47
48 Create a Alien::Build instance from the given alienfile. The first two
49 forms are abbreviations.
50
51 my $build = alienfile;
52 # is the same as
53 my $build = alienfile filename => 'alienfile';
54
55 and
56
57 my $build = alienfile q{ use alienfile ... };
58 # is the same as
59 my $build = alienfile source => q{ use alienfile ... };
60
61 Except for the second abbreviated form sets the line number before
62 feeding the source into Alien::Build so that you will get diagnostics
63 with the correct line numbers.
64
65 source
66 The source for the alienfile as a string. You must specify one of
67 "source" or "filename".
68
69 filename
70 The filename for the alienfile. You must specify one of "source"
71 or "filename".
72
73 root
74 The build root.
75
76 stage
77 The staging area for the build.
78
79 prefix
80 The install prefix for the build.
81
82 alienfile_ok
83 my $build = alienfile_ok;
84 my $build = alienfile_ok q{ use alienfile ... };
85 my $build = alienfile_ok filename => 'alienfile';
86 my $build = alienfile_ok $build;
87
88 Same as "alienfile" above, except that it runs as a test, and will not
89 throw an exception on failure (it will return undef instead).
90
91 [version 1.49]
92
93 As of version 1.49 you can also pass in an already formed instance of
94 Alien::Build. This allows you to do something like this:
95
96 subtest 'a subtest' => sub {
97 my $build = alienfile q{ use alienfile; ... };
98 alienfile_skip_if_missing_prereqs; # skip if alienfile prereqs are missing
99 alienfile_ok $build; # delayed pass/fail for the compile of alienfile
100 };
101
102 alienfile_skip_if_missing_prereqs
103 alienfile_skip_if_missing_prereqs;
104 alienfile_skip_if_missing_prereqs $phase;
105
106 Skips the test or subtest if the prereqs for the alienfile are missing.
107 If $phase is not given, then either "share" or "system" will be
108 detected.
109
110 alien_install_type_is
111 alien_install_type_is $type;
112 alien_install_type_is $type, $name;
113
114 Simple test to see if the install type is what you expect. $type
115 should be one of "system" or "share".
116
117 alien_download_ok
118 my $file = alien_download_ok;
119 my $file = alien_download_ok $name;
120
121 Makes a download attempt and test that a file or directory results.
122 Returns the file or directory if successful. Returns "undef"
123 otherwise.
124
125 alien_extract_ok
126 my $dir = alien_extract_ok;
127 my $dir = alien_extract_ok $archive;
128 my $dir = alien_extract_ok $archive, $name;
129 my $dir = alien_extract_ok undef, $name;
130
131 Makes an extraction attempt and test that a directory results. Returns
132 the directory if successful. Returns "undef" otherwise.
133
134 alien_build_ok
135 my $alien = alien_build_ok;
136 my $alien = alien_build_ok $name;
137 my $alien = alien_build_ok { class => $class };
138 my $alien = alien_build_ok { class => $class }, $name;
139
140 Runs the download and build stages. Passes if the build succeeds.
141 Returns an instance of Alien::Base which can be passed into "alien_ok"
142 from Test::Alien. Returns "undef" if the test fails.
143
144 Options
145
146 class
147 The base class to use for your alien. This is Alien::Base by
148 default. Should be a subclass of Alien::Base, or at least adhere
149 to its API.
150
151 alien_build_clean
152 alien_build_clean;
153
154 Removes all files with the current build, except for the runtime
155 prefix. This helps test that the final install won't depend on the
156 build files.
157
158 alien_checkpoint_ok
159 alien_checkpoint_ok;
160 alien_checkpoint_ok $test_name;
161
162 Test the checkpoint of a build.
163
164 alien_resume_ok
165 alien_resume_ok;
166 alien_resume_ok $test_name;
167
168 Test a resume a checkpointed build.
169
170 alien_rc
171 alien_rc $code;
172
173 Creates "rc.pl" file in a temp directory and sets ALIEN_BUILD_RC.
174 Useful for testing plugins that should be called from
175 "~/.alienbuild/rc.pl". Note that because of the nature of how the
176 "~/.alienbuild/rc.pl" file works, you can only use this once!
177
178 alien_subtest
179 alienfile_subtest $test_name => sub {
180 ...
181 };
182
183 Clear the build object and clear the build object before and after the
184 subtest.
185
187 Alien
188 alienfile
189 Alien::Build
190 Test::Alien
191
193 Author: Graham Ollis <plicease@cpan.org>
194
195 Contributors:
196
197 Diab Jerius (DJERIUS)
198
199 Roy Storey
200
201 Ilya Pavlov
202
203 David Mertens (run4flat)
204
205 Mark Nunberg (mordy, mnunberg)
206
207 Christian Walde (Mithaldu)
208
209 Brian Wightman (MidLifeXis)
210
211 Zaki Mughal (zmughal)
212
213 mohawk (mohawk2, ETJ)
214
215 Vikas N Kumar (vikasnkumar)
216
217 Flavio Poletti (polettix)
218
219 Salvador Fandiño (salva)
220
221 Gianni Ceccarelli (dakkar)
222
223 Pavel Shaydo (zwon, trinitum)
224
225 Kang-min Liu (劉康民, gugod)
226
227 Nicholas Shipp (nshp)
228
229 Juan Julián Merelo Guervós (JJ)
230
231 Joel Berger (JBERGER)
232
233 Petr Pisar (ppisar)
234
235 Lance Wicks (LANCEW)
236
237 Ahmad Fatoum (a3f, ATHREEF)
238
239 José Joaquín Atria (JJATRIA)
240
241 Duke Leto (LETO)
242
243 Shoichi Kaji (SKAJI)
244
245 Shawn Laffan (SLAFFAN)
246
247 Paul Evans (leonerd, PEVANS)
248
250 This software is copyright (c) 2011-2018 by Graham Ollis.
251
252 This is free software; you can redistribute it and/or modify it under
253 the same terms as the Perl 5 programming language system itself.
254
255
256
257perl v5.28.1 2019-02-24 Test::Alien::Build(3)