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_...
This commit is contained in:
parent
fbb894af4e
commit
4b886d9c45
38
.gitignore
vendored
38
.gitignore
vendored
|
@ -1,43 +1,7 @@
|
|||
/.pls_cache
|
||||
*.o
|
||||
*~
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.hydra-data
|
||||
/config.guess
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/depcomp
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/autom4te.cache
|
||||
/aclocal.m4
|
||||
/missing
|
||||
/install-sh
|
||||
.test_info.*
|
||||
/src/sql/hydra-postgresql.sql
|
||||
/src/sql/hydra-sqlite.sql
|
||||
/src/sql/tmp.sqlite
|
||||
/tests
|
||||
/doc/manual/images
|
||||
/doc/manual/manual.html
|
||||
/doc/manual/manual.pdf
|
||||
/t/.bzr*
|
||||
/t/.git*
|
||||
/t/.hg*
|
||||
/t/nix
|
||||
/t/data
|
||||
/t/jobs/config.nix
|
||||
t/jobs/declarative/project.json
|
||||
/inst
|
||||
hydra-config.h
|
||||
hydra-config.h.in
|
||||
result
|
||||
result-*
|
||||
outputs
|
||||
config
|
||||
stamp-h1
|
||||
src/hydra-evaluator/hydra-evaluator
|
||||
src/hydra-queue-runner/hydra-queue-runner
|
||||
|
|
12
Makefile.am
12
Makefile.am
|
@ -1,12 +0,0 @@
|
|||
SUBDIRS = src doc
|
||||
if CAN_DO_CHECK
|
||||
SUBDIRS += t
|
||||
endif
|
||||
|
||||
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
EXTRA_DIST = nixos-modules/hydra.nix
|
||||
|
||||
install-data-local: nixos-modules/hydra.nix
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix
|
||||
$(INSTALL_DATA) nixos-modules/hydra.nix $(DESTDIR)$(datadir)/nix/hydra-module.nix
|
90
configure.ac
90
configure.ac
|
@ -1,90 +0,0 @@
|
|||
AC_INIT([Hydra], [m4_esyscmd([echo -n $(cat ./version.txt)$VERSION_SUFFIX])])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AM_INIT_AUTOMAKE([foreign serial-tests])
|
||||
|
||||
AC_LANG([C++])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_CXX
|
||||
|
||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||
|
||||
AC_ARG_WITH([docbook-xsl],
|
||||
[AS_HELP_STRING([--with-docbook-xsl=PATH],
|
||||
[path of the DocBook XSL stylesheets])],
|
||||
[docbookxsl="$withval"],
|
||||
[docbookxsl="/docbook-xsl-missing"])
|
||||
AC_SUBST([docbookxsl])
|
||||
|
||||
|
||||
AC_DEFUN([NEED_PROG],
|
||||
[
|
||||
AC_PATH_PROG($1, $2)
|
||||
if test -z "$$1"; then
|
||||
AC_MSG_ERROR([$2 is required])
|
||||
fi
|
||||
])
|
||||
|
||||
NEED_PROG(perl, perl)
|
||||
|
||||
NEED_PROG([NIX_STORE_PROGRAM], [nix-store])
|
||||
|
||||
AC_MSG_CHECKING([whether $NIX_STORE_PROGRAM is recent enough])
|
||||
if test -n "$NIX_STORE" -a -n "$TMPDIR"
|
||||
then
|
||||
# This may be executed from within a build chroot, so pacify
|
||||
# `nix-store' instead of letting it choke while trying to mkdir
|
||||
# /nix/var.
|
||||
NIX_STATE_DIR="$TMPDIR"
|
||||
export NIX_STATE_DIR
|
||||
fi
|
||||
if NIX_REMOTE=daemon PAGER=cat "$NIX_STORE_PROGRAM" --timeout 123 -q; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([`$NIX_STORE_PROGRAM' doesn't support `--timeout'; please use a newer version.])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([NIX], [lix-main lix-expr lix-store])
|
||||
|
||||
testPath="$(dirname $(type -p expr))"
|
||||
AC_SUBST(testPath)
|
||||
|
||||
CXXFLAGS+=" -include lix/config.h -std=gnu++20"
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
doc/manual/Makefile
|
||||
src/Makefile
|
||||
src/hydra-evaluator/Makefile
|
||||
src/hydra-queue-runner/Makefile
|
||||
src/sql/Makefile
|
||||
src/ttf/Makefile
|
||||
src/lib/Makefile
|
||||
src/root/Makefile
|
||||
src/script/Makefile
|
||||
])
|
||||
|
||||
# Tests might be filtered out
|
||||
AM_CONDITIONAL([CAN_DO_CHECK], [test -f "$srcdir/t/api-test.t"])
|
||||
AM_COND_IF(
|
||||
[CAN_DO_CHECK],
|
||||
[
|
||||
jobsPath="$(realpath ./t/jobs)"
|
||||
AC_SUBST(jobsPath)
|
||||
AC_CONFIG_FILES([
|
||||
t/Makefile
|
||||
t/jobs/config.nix
|
||||
t/jobs/declarative/project.json
|
||||
])
|
||||
])
|
||||
|
||||
AC_CONFIG_COMMANDS([executable-scripts], [])
|
||||
|
||||
AC_CONFIG_HEADER([hydra-config.h])
|
||||
|
||||
AC_OUTPUT
|
|
@ -1,4 +0,0 @@
|
|||
SUBDIRS = manual
|
||||
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
MD_FILES = src/*.md
|
||||
|
||||
EXTRA_DIST = $(MD_FILES)
|
||||
|
||||
install: $(MD_FILES)
|
||||
mdbook build . -d $(docdir)
|
33
doc/manual/meson.build
Normal file
33
doc/manual/meson.build
Normal file
|
@ -0,0 +1,33 @@
|
|||
srcs = files(
|
||||
'src/SUMMARY.md',
|
||||
'src/about.md',
|
||||
'src/api.md',
|
||||
'src/configuration.md',
|
||||
'src/hacking.md',
|
||||
'src/installation.md',
|
||||
'src/introduction.md',
|
||||
'src/jobs.md',
|
||||
'src/monitoring/README.md',
|
||||
'src/notifications.md',
|
||||
'src/plugins/README.md',
|
||||
'src/plugins/RunCommand.md',
|
||||
'src/plugins/declarative-projects.md',
|
||||
'src/projects.md',
|
||||
'src/webhooks.md',
|
||||
)
|
||||
|
||||
manual = custom_target(
|
||||
'manual',
|
||||
command: [
|
||||
mdbook, 'build', '@SOURCE_ROOT@/doc/manual', '-d', meson.current_build_dir() / 'html'
|
||||
],
|
||||
depend_files: srcs,
|
||||
output: ['html'],
|
||||
build_by_default: true,
|
||||
)
|
||||
|
||||
install_subdir(
|
||||
manual.full_path(),
|
||||
install_dir: get_option('datadir') / 'doc/hydra',
|
||||
strip_directory: true,
|
||||
)
|
36
meson.build
Normal file
36
meson.build
Normal file
|
@ -0,0 +1,36 @@
|
|||
project('hydra', 'cpp',
|
||||
version: files('version.txt'),
|
||||
license: 'GPL-3.0',
|
||||
default_options: [
|
||||
'debug=true',
|
||||
'optimization=2',
|
||||
'cpp_std=c++20',
|
||||
],
|
||||
)
|
||||
|
||||
lix_expr_dep = dependency('lix-expr', required: true)
|
||||
lix_main_dep = dependency('lix-main', required: true)
|
||||
lix_store_dep = dependency('lix-store', required: true)
|
||||
|
||||
# Lix/Nix need extra flags not provided in its pkg-config files.
|
||||
lix_dep = declare_dependency(
|
||||
dependencies: [
|
||||
lix_expr_dep,
|
||||
lix_main_dep,
|
||||
lix_store_dep,
|
||||
],
|
||||
compile_args: ['-include', 'lix/config.h'],
|
||||
)
|
||||
|
||||
pqxx_dep = dependency('libpqxx', required: true)
|
||||
|
||||
prom_cpp_core_dep = dependency('prometheus-cpp-core', required: true)
|
||||
prom_cpp_pull_dep = dependency('prometheus-cpp-pull', required: true)
|
||||
|
||||
mdbook = find_program('mdbook', native: true)
|
||||
perl = find_program('perl', native: true)
|
||||
|
||||
subdir('doc/manual')
|
||||
subdir('nixos-modules')
|
||||
subdir('src')
|
||||
subdir('t')
|
4
nixos-modules/meson.build
Normal file
4
nixos-modules/meson.build
Normal file
|
@ -0,0 +1,4 @@
|
|||
install_data('hydra.nix',
|
||||
install_dir: get_option('datadir') / 'nix',
|
||||
rename: ['hydra-module.nix'],
|
||||
)
|
35
package.nix
35
package.nix
|
@ -12,7 +12,8 @@
|
|||
, git
|
||||
|
||||
, makeWrapper
|
||||
, autoreconfHook
|
||||
, meson
|
||||
, ninja
|
||||
, nukeReferences
|
||||
, pkg-config
|
||||
, mdbook
|
||||
|
@ -92,6 +93,7 @@ let
|
|||
DigestSHA1
|
||||
EmailMIME
|
||||
EmailSender
|
||||
FileCopyRecursive
|
||||
FileLibMagic
|
||||
FileSlurper
|
||||
FileWhich
|
||||
|
@ -139,20 +141,13 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
src = fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = fileset.unions ([
|
||||
./version.txt
|
||||
./configure.ac
|
||||
./Makefile.am
|
||||
./src
|
||||
./doc
|
||||
./nixos-modules/hydra.nix
|
||||
# These are always needed to appease Automake
|
||||
./t/Makefile.am
|
||||
./t/jobs/config.nix.in
|
||||
./t/jobs/declarative/project.json.in
|
||||
] ++ lib.optionals finalAttrs.doCheck [
|
||||
./meson.build
|
||||
./nixos-modules
|
||||
./src
|
||||
./t
|
||||
./version.txt
|
||||
./.perlcriticrc
|
||||
./.yath.rc
|
||||
]);
|
||||
};
|
||||
|
||||
|
@ -160,7 +155,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
autoreconfHook
|
||||
meson
|
||||
ninja
|
||||
nukeReferences
|
||||
pkg-config
|
||||
mdbook
|
||||
|
@ -228,6 +224,12 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
OPENLDAP_ROOT = openldap;
|
||||
|
||||
mesonBuildType = "release";
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
shellHook = ''
|
||||
pushd $(git rev-parse --show-toplevel) >/dev/null
|
||||
|
||||
|
@ -241,14 +243,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
popd >/dev/null
|
||||
'';
|
||||
|
||||
NIX_LDFLAGS = [ "-lpthread" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
mesonCheckFlags = [ "--verbose" ];
|
||||
|
||||
preCheck = ''
|
||||
patchShebangs .
|
||||
export LOGNAME=''${LOGNAME:-foo}
|
||||
# set $HOME for bzr so it can create its trace file
|
||||
export HOME=$(mktemp -d)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
SUBDIRS = hydra-evaluator hydra-queue-runner sql script lib root ttf
|
||||
BOOTCLEAN_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
|
@ -1,5 +0,0 @@
|
|||
bin_PROGRAMS = hydra-evaluator
|
||||
|
||||
hydra_evaluator_SOURCES = hydra-evaluator.cc
|
||||
hydra_evaluator_LDADD = $(NIX_LIBS) -lpqxx
|
||||
hydra_evaluator_CXXFLAGS = $(NIX_CFLAGS) -Wall -I ../libhydra -Wno-deprecated-declarations
|
9
src/hydra-evaluator/meson.build
Normal file
9
src/hydra-evaluator/meson.build
Normal file
|
@ -0,0 +1,9 @@
|
|||
hydra_evaluator = executable('hydra-evaluator',
|
||||
'hydra-evaluator.cc',
|
||||
dependencies: [
|
||||
libhydra_dep,
|
||||
lix_dep,
|
||||
pqxx_dep,
|
||||
],
|
||||
install: true,
|
||||
)
|
|
@ -1,8 +0,0 @@
|
|||
bin_PROGRAMS = hydra-queue-runner
|
||||
|
||||
hydra_queue_runner_SOURCES = hydra-queue-runner.cc queue-monitor.cc dispatcher.cc \
|
||||
builder.cc build-result.cc build-remote.cc \
|
||||
hydra-build-result.hh counter.hh state.hh db.hh \
|
||||
nar-extractor.cc nar-extractor.hh
|
||||
hydra_queue_runner_LDADD = $(NIX_LIBS) -lpqxx -lprometheus-cpp-pull -lprometheus-cpp-core
|
||||
hydra_queue_runner_CXXFLAGS = $(NIX_CFLAGS) -Wall -I ../libhydra -Wno-deprecated-declarations
|
22
src/hydra-queue-runner/meson.build
Normal file
22
src/hydra-queue-runner/meson.build
Normal file
|
@ -0,0 +1,22 @@
|
|||
srcs = files(
|
||||
'builder.cc',
|
||||
'build-remote.cc',
|
||||
'build-result.cc',
|
||||
'dispatcher.cc',
|
||||
'hydra-queue-runner.cc',
|
||||
'nar-extractor.cc',
|
||||
'queue-monitor.cc',
|
||||
)
|
||||
|
||||
hydra_queue_runner = executable('hydra-queue-runner',
|
||||
'hydra-queue-runner.cc',
|
||||
srcs,
|
||||
dependencies: [
|
||||
libhydra_dep,
|
||||
lix_dep,
|
||||
pqxx_dep,
|
||||
prom_cpp_core_dep,
|
||||
prom_cpp_pull_dep,
|
||||
],
|
||||
install: true,
|
||||
)
|
|
@ -1,22 +0,0 @@
|
|||
PERL_MODULES = \
|
||||
$(wildcard *.pm) \
|
||||
$(wildcard Hydra/*.pm) \
|
||||
$(wildcard Hydra/Helper/*.pm) \
|
||||
$(wildcard Hydra/Model/*.pm) \
|
||||
$(wildcard Hydra/View/*.pm) \
|
||||
$(wildcard Hydra/Schema/*.pm) \
|
||||
$(wildcard Hydra/Schema/Result/*.pm) \
|
||||
$(wildcard Hydra/Schema/ResultSet/*.pm) \
|
||||
$(wildcard Hydra/Controller/*.pm) \
|
||||
$(wildcard Hydra/Base/*.pm) \
|
||||
$(wildcard Hydra/Base/Controller/*.pm) \
|
||||
$(wildcard Hydra/Script/*.pm) \
|
||||
$(wildcard Hydra/Component/*.pm) \
|
||||
$(wildcard Hydra/Event/*.pm) \
|
||||
$(wildcard Hydra/Plugin/*.pm)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(PERL_MODULES)
|
||||
|
||||
hydradir = $(libexecdir)/hydra/lib
|
||||
nobase_hydra_DATA = $(PERL_MODULES)
|
5
src/libhydra/meson.build
Normal file
5
src/libhydra/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
libhydra_inc = include_directories('.')
|
||||
|
||||
libhydra_dep = declare_dependency(
|
||||
include_directories: [libhydra_inc],
|
||||
)
|
16
src/meson.build
Normal file
16
src/meson.build
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Native code
|
||||
subdir('libhydra')
|
||||
subdir('hydra-evaluator')
|
||||
subdir('hydra-queue-runner')
|
||||
|
||||
# Data and interpreted
|
||||
foreach dir : ['lib', 'root', 'sql', 'ttf']
|
||||
install_subdir(dir,
|
||||
install_dir: get_option('libexecdir') / 'hydra',
|
||||
)
|
||||
endforeach
|
||||
install_subdir('script',
|
||||
install_dir: get_option('bindir'),
|
||||
install_mode: 'rwxr-xr-x',
|
||||
strip_directory: true,
|
||||
)
|
|
@ -1,23 +0,0 @@
|
|||
TEMPLATES = $(wildcard *.tt)
|
||||
STATIC = \
|
||||
$(wildcard static/images/*) \
|
||||
$(wildcard static/css/*) \
|
||||
static/js/bootbox.min.js \
|
||||
static/js/popper.min.js \
|
||||
static/js/common.js \
|
||||
static/js/jquery/jquery-3.4.1.min.js \
|
||||
static/js/jquery/jquery-ui-1.10.4.min.js
|
||||
|
||||
EXTRA_DIST = $(TEMPLATES) $(STATIC)
|
||||
|
||||
hydradir = $(libexecdir)/hydra/root
|
||||
nobase_hydra_DATA = $(EXTRA_DIST)
|
||||
|
||||
install-data-local: $(ZIPS)
|
||||
mkdir -p $(hydradir)/static/js
|
||||
cp -prvd $(srcdir)/static/js/* $(hydradir)/static/js
|
||||
mkdir -p $(hydradir)/static/bootstrap
|
||||
cp -prvd $(srcdir)/static/bootstrap/* $(hydradir)/static/bootstrap
|
||||
mkdir -p $(hydradir)/static/fontawesome/{css,webfonts}
|
||||
cp -prvd $(srcdir)/static/fontawesome/css/* $(hydradir)/static/fontawesome/css
|
||||
cp -prvd $(srcdir)/static/fontawesome/webfonts/* $(hydradir)/static/fontawesome/webfonts
|
|
@ -1,19 +0,0 @@
|
|||
EXTRA_DIST = \
|
||||
$(distributable_scripts)
|
||||
|
||||
distributable_scripts = \
|
||||
hydra-backfill-ids \
|
||||
hydra-init \
|
||||
hydra-eval-jobset \
|
||||
hydra-server \
|
||||
hydra-update-gc-roots \
|
||||
hydra-s3-backup-collect-garbage \
|
||||
hydra-create-user \
|
||||
hydra-notify \
|
||||
hydra-send-stats \
|
||||
nix-prefetch-git \
|
||||
nix-prefetch-bzr \
|
||||
nix-prefetch-hg
|
||||
|
||||
bin_SCRIPTS = \
|
||||
$(distributable_scripts)
|
|
@ -1,9 +0,0 @@
|
|||
sqldir = $(libexecdir)/hydra/sql
|
||||
nobase_dist_sql_DATA = \
|
||||
hydra.sql \
|
||||
test.sql \
|
||||
upgrade-*.sql \
|
||||
update-dbix.pl
|
||||
|
||||
update-dbix: hydra.sql
|
||||
./update-dbix-harness.sh
|
|
@ -1,4 +0,0 @@
|
|||
EXTRA_DIST = COPYING.LIB StayPuft.ttf
|
||||
|
||||
ttfdir = $(libexecdir)/hydra/ttf
|
||||
nobase_ttf_DATA = $(EXTRA_DIST)
|
|
@ -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-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));
|
||||
}
|
||||
|
|
42
t/meson.build
Normal file
42
t/meson.build
Normal file
|
@ -0,0 +1,42 @@
|
|||
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_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,
|
||||
)
|
Loading…
Reference in a new issue