autotools -> meson
Original commit message: > There are some known regressions regarding local testing setups - since > everything was kinda half written with the expectation that build dir = > source dir (which should not be true anymore). But everything builds and > the test suite runs fine, after several hours spent debugging random > crashes in libpqxx with MALLOC_PERTURB_... I have not experienced regressions with local testing. (cherry picked from commit 4b886d9c45cd2d7fe9b0a8dbc05c7318d46f615d)
This commit is contained in:
committed by
John Ericson
parent
f974891c76
commit
182a48c9fb
@ -1,39 +0,0 @@
|
||||
TESTS_ENVIRONMENT = \
|
||||
BZR_HOME="$(abs_builddir)/data" \
|
||||
HYDRA_DBI="dbi:Pg:dbname=hydra-test-suite;port=6433" \
|
||||
HYDRA_DATA="$(abs_builddir)/data" \
|
||||
HYDRA_HOME="$(top_srcdir)/src" \
|
||||
HYDRA_CONFIG= \
|
||||
NIX_REMOTE= \
|
||||
NIX_REMOTE_SYSTEMS= \
|
||||
NIX_CONF_DIR="$(abs_builddir)/nix/etc/nix" \
|
||||
NIX_STATE_DIR="$(abs_builddir)/nix/var/nix" \
|
||||
NIX_STORE_DIR="$(abs_builddir)/nix/store" \
|
||||
NIX_LOG_DIR="$(abs_builddir)/nix/var/log/nix" \
|
||||
PGHOST=/tmp \
|
||||
PERL5LIB="$(srcdir):$(abs_top_srcdir)/src/lib:$$PERL5LIB" \
|
||||
PYTHONPATH= \
|
||||
PATH=$(abs_top_srcdir)/src/hydra-evaluator:$(abs_top_srcdir)/src/script:$(abs_top_srcdir)/src/hydra-eval-jobs:$(abs_top_srcdir)/src/hydra-queue-runner:$$PATH \
|
||||
perl -w
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(wildcard *.pm) \
|
||||
$(wildcard jobs/*.nix) \
|
||||
$(wildcard jobs/*.sh) \
|
||||
$(TESTS)
|
||||
|
||||
TESTS = \
|
||||
perlcritic.pl \
|
||||
test.pl
|
||||
|
||||
check_SCRIPTS = repos
|
||||
|
||||
repos: dirs
|
||||
|
||||
dirs:
|
||||
mkdir -p data
|
||||
touch data/hydra.conf
|
||||
mkdir -p nix
|
||||
mkdir -p nix/etc/nix
|
||||
mkdir -p nix/store
|
||||
mkdir -p nix/var
|
@ -4,6 +4,8 @@ use warnings;
|
||||
package HydraTestContext;
|
||||
use File::Path qw(make_path);
|
||||
use File::Basename;
|
||||
use File::Copy::Recursive qw(rcopy);
|
||||
use File::Which qw(which);
|
||||
use Cwd qw(abs_path getcwd);
|
||||
use CliRunners;
|
||||
use Hydra::Helper::Exec;
|
||||
@ -77,6 +79,13 @@ sub new {
|
||||
);
|
||||
$ENV{'HYDRA_DBI'} = $pgsql->dsn;
|
||||
|
||||
my $jobsdir = "$dir/jobs";
|
||||
rcopy(abs_path(dirname(__FILE__) . "/../jobs"), $jobsdir);
|
||||
|
||||
my $coreutils_path = dirname(which 'install');
|
||||
replace_variable_in_file($jobsdir . "/config.nix", '@testPath@', $coreutils_path);
|
||||
replace_variable_in_file($jobsdir . "/declarative/project.json", '@jobsPath@', $jobsdir);
|
||||
|
||||
my $self = bless {
|
||||
_db => undef,
|
||||
db_handle => $pgsql,
|
||||
@ -84,7 +93,7 @@ sub new {
|
||||
nix_state_dir => $nix_state_dir,
|
||||
nix_log_dir => $nix_log_dir,
|
||||
testdir => abs_path(dirname(__FILE__) . "/.."),
|
||||
jobsdir => abs_path(dirname(__FILE__) . "/../jobs"),
|
||||
jobsdir => $jobsdir,
|
||||
deststoredir => $deststoredir,
|
||||
}, $class;
|
||||
|
||||
@ -243,6 +252,18 @@ sub write_file {
|
||||
close $fh;
|
||||
}
|
||||
|
||||
sub replace_variable_in_file {
|
||||
my ($fn, $var, $val) = @_;
|
||||
|
||||
open (my $input, '<', "$fn.in") or die $!;
|
||||
open (my $output, '>', $fn) or die $!;
|
||||
|
||||
while (my $line = <$input>) {
|
||||
$line =~ s/$var/$val/g;
|
||||
print $output $line;
|
||||
}
|
||||
}
|
||||
|
||||
sub rand_chars {
|
||||
return sprintf("t%08X", rand(0xFFFFFFFF));
|
||||
}
|
||||
|
43
t/meson.build
Normal file
43
t/meson.build
Normal file
@ -0,0 +1,43 @@
|
||||
fs = import('fs')
|
||||
|
||||
test('perlcritic',
|
||||
perl,
|
||||
args: ['-w', files('perlcritic.pl')],
|
||||
workdir: meson.project_source_root(),
|
||||
timeout: -1,
|
||||
)
|
||||
|
||||
testenv = environment(
|
||||
{
|
||||
'BZR_HOME': meson.current_build_dir() / 'data',
|
||||
'HYDRA_DBI': 'dbi:Pg:dbname=hydra-test-suite;port=6433',
|
||||
'HYDRA_DATA': meson.current_build_dir() / 'data',
|
||||
'HYDRA_HOME': meson.project_source_root() / 'src',
|
||||
'PGHOST': '/tmp',
|
||||
'PYTHONPATH': '',
|
||||
|
||||
# libpqxx seems to randomly crash with certain values of MALLOC_PERTURB_,
|
||||
# set by default by Meson's test(). Very promising, high quality software.
|
||||
'MALLOC_PERTURB_': '0',
|
||||
},
|
||||
)
|
||||
testenv.prepend('PERL5LIB',
|
||||
meson.current_source_dir(),
|
||||
meson.project_source_root() / 'src/lib',
|
||||
separator: ':'
|
||||
)
|
||||
testenv.prepend('PATH',
|
||||
fs.parent(hydra_eval_jobs.full_path()),
|
||||
fs.parent(hydra_evaluator.full_path()),
|
||||
fs.parent(hydra_queue_runner.full_path()),
|
||||
meson.project_source_root() / 'src/script',
|
||||
separator: ':'
|
||||
)
|
||||
|
||||
test('testsuite',
|
||||
perl,
|
||||
args: ['-I', meson.current_source_dir() / 'lib', '-w', files('test.pl')],
|
||||
env: testenv,
|
||||
workdir: meson.current_source_dir(),
|
||||
timeout: -1,
|
||||
)
|
Reference in New Issue
Block a user