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 2.77
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_clean_install
159 alien_clean_install;
160
161 Runs "$build->clean_install", and verifies it did not crash.
162
163 alien_checkpoint_ok
164 alien_checkpoint_ok;
165 alien_checkpoint_ok $test_name;
166
167 Test the checkpoint of a build.
168
169 alien_resume_ok
170 alien_resume_ok;
171 alien_resume_ok $test_name;
172
173 Test a resume a checkpointed build.
174
175 alien_rc
176 alien_rc $code;
177
178 Creates "rc.pl" file in a temp directory and sets ALIEN_BUILD_RC.
179 Useful for testing plugins that should be called from
180 "~/.alienbuild/rc.pl". Note that because of the nature of how the
181 "~/.alienbuild/rc.pl" file works, you can only use this once!
182
183 alien_subtest
184 alien_subtest $test_name => sub {
185 ...
186 };
187
188 Clear the build object and clear the build object before and after the
189 subtest.
190
192 Alien
193 alienfile
194 Alien::Build
195 Test::Alien
196
198 Author: Graham Ollis <plicease@cpan.org>
199
200 Contributors:
201
202 Diab Jerius (DJERIUS)
203
204 Roy Storey (KIWIROY)
205
206 Ilya Pavlov
207
208 David Mertens (run4flat)
209
210 Mark Nunberg (mordy, mnunberg)
211
212 Christian Walde (Mithaldu)
213
214 Brian Wightman (MidLifeXis)
215
216 Zaki Mughal (zmughal)
217
218 mohawk (mohawk2, ETJ)
219
220 Vikas N Kumar (vikasnkumar)
221
222 Flavio Poletti (polettix)
223
224 Salvador Fandiño (salva)
225
226 Gianni Ceccarelli (dakkar)
227
228 Pavel Shaydo (zwon, trinitum)
229
230 Kang-min Liu (劉康民, gugod)
231
232 Nicholas Shipp (nshp)
233
234 Juan Julián Merelo Guervós (JJ)
235
236 Joel Berger (JBERGER)
237
238 Petr Písař (ppisar)
239
240 Lance Wicks (LANCEW)
241
242 Ahmad Fatoum (a3f, ATHREEF)
243
244 José Joaquín Atria (JJATRIA)
245
246 Duke Leto (LETO)
247
248 Shoichi Kaji (SKAJI)
249
250 Shawn Laffan (SLAFFAN)
251
252 Paul Evans (leonerd, PEVANS)
253
254 Håkon Hægland (hakonhagland, HAKONH)
255
256 nick nauwelaerts (INPHOBIA)
257
258 Florian Weimer
259
261 This software is copyright (c) 2011-2022 by Graham Ollis.
262
263 This is free software; you can redistribute it and/or modify it under
264 the same terms as the Perl 5 programming language system itself.
265
266
267
268perl v5.36.0 2023-01-20 Test::Alien::Build(3)