Add a comment to 90-test_external.t to explain why we need filter_run
[openssl.git] / test / recipes / 90-test_external.t
1 #! /usr/bin/env perl
2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9
10 use OpenSSL::Test;
11 use OpenSSL::Test::Utils;
12 use OpenSSL::Test qw/:DEFAULT srctop_file cmdstr/;
13
14 setup("test_external");
15
16 if (!$ENV{BORING_RUNNER_DIR}) {
17     plan skip_all => "No external tests have been detected";
18 }
19
20 plan tests => 1;
21
22 indir $ENV{BORING_RUNNER_DIR} => sub {
23     ok(filter_run(cmd(["go", "test", "-shim-path",
24                       srctop_file("test", "ossl_shim", "ossl_shim"),
25                       "-shim-config",
26                       srctop_file("test", "ossl_shim", "ossl_config.json"),
27                       "-pipe"])),
28         "running external tests");
29 }, create => 0, cleanup => 0;
30
31 # Filter the output so that the "ok" printed by go test doesn't confuse
32 # Test::More. Without that it thinks there has been one more test run than was
33 # planned
34 sub filter_run {
35     my $cmd = cmdstr(shift);
36     open(PIPE, "-|", $cmd);
37     while(<PIPE>) {
38         print STDOUT "go test: ", $_;
39     }
40     close PIPE;
41 }