File: run_ndbapitest.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (85 lines) | stat: -rw-r--r-- 2,329 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# All test using run_ndbapitest.inc should automatically be
# skipped (by mtr_cases.pm) unless the NDB test programs are available
if (!$NDBT_BINARIES_AVAILABLE) {
  die Should be autoskipped when NDB test binaries not available;
}

source include/full_result_diff.inc;

--perl
use strict;
use lib "lib/";
use My::Find;
use My::Exec;
use File::Basename;
use IO::File;

my $name = $ENV{NDBAPITEST_NAME} or die "Need NDBAPITEST_NAME";
my $defaults;
if (defined $ENV{NDBAPITEST_DEFAULTS}) {
  $defaults = $ENV{NDBAPITEST_DEFAULTS};
}
else {
  if (defined $ENV{PATH_CONFIG_FILE}) {
    $defaults = "--defaults-file=".$ENV{PATH_CONFIG_FILE};
  }
}
my $args = $ENV{NDBAPITEST_ARGS};
my $max_lines = $ENV{NDBAPITEST_MAXLINES} || 200;

my $mysql_test_dir = $ENV{MYSQL_TEST_DIR} or die "Need MYSQL_TEST_DIR";
my $basedir = dirname($mysql_test_dir);
my $bindir = $ENV{MTR_BINDIR} || $basedir; # Out of source set MTR_BINDIR
my $test_bin = my_find_bin($bindir,
		           ["runtime_output_directory", "bin"],
                           $name, NOT_REQUIRED);

my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
my $F = IO::File->new("$vardir/tmp/run_ndbapitest_result.inc", "w") or die;
unless($test_bin)
{
  print $F "--let \$skip_test = 1\n";
  print $F "--let \$skip_reason = skip Could not find $name\n";
  exit(0);
}

if ($ENV{'MYSQL_TMP_DIR'})
{
  $ENV{'NDBT_TMP_DIR'} = $ENV{'MYSQL_TMP_DIR'};
}

my $cmd = $test_bin;
$cmd .= " $defaults" if $defaults;
$cmd .= " $args" if $args;
my $res = exec_print_on_error($cmd, $max_lines);
if (!$res)
{
  # No need to remove run_ndbapitest_result.inc when test case dies. Because,
  # when it dies MTR fails and returns without executing check-testcase.test.

  print $F "die Test program failed!;\n";
}
$F->close(); 

EOF

if ($NDBAPITEST_CLEANUP_QUERY != '')
{
  eval $NDBAPITEST_CLEANUP_QUERY;
}

--source $MYSQLTEST_VARDIR/tmp/run_ndbapitest_result.inc
--remove_file $MYSQLTEST_VARDIR/tmp/run_ndbapitest_result.inc

# When we --source run_ndbapitest_result.inc, if test is skipped,
# test case will return immediately and will not execute other commands
# after --source. So, remove file will not get executed and check test
# case will fail. Hence, moving --skip outside run_ndbapitest_result.inc.

if ($skip_test)
{
  --skip $skip_reason
}

--echo Test program success!