mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
Add 'make postgres' Makefile target.
That would build postgres and install it into REPO_ROOT/tmp_install where pageserver integration tests would be able to find it.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/target
|
||||
/tmp_install
|
||||
|
||||
34
Makefile
Normal file
34
Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Purpose of this Makefile is to build and install postgres in a local directory
|
||||
# so that zenith intergation tests would find pg binaries and support files.
|
||||
#
|
||||
# 'make postgres' would do following:
|
||||
#
|
||||
# 1) run out-of-source build of postgres in REPO_ROOT/tmp_install/build directory (I'm reusing
|
||||
# tmp_install path here since it is already present in .gitignore)
|
||||
#
|
||||
# 2) installs postgres to REPO_ROOT/tmp_install/
|
||||
#
|
||||
# This Makefile is integrated with cargo build by the means of build.rs file (special file
|
||||
# that cargo build would run if it is present) which will call `make postgres` if there is no
|
||||
# tmp_install/bin/postgres binary.
|
||||
#
|
||||
|
||||
../tmp_install/build/Makefile:
|
||||
mkdir -p ../tmp_install/build && \
|
||||
cd ../tmp_install/build && \
|
||||
../../configure CFLAGS='-O0' --enable-debug --enable-cassert \
|
||||
--enable-depend --with-libxml --prefix=/
|
||||
|
||||
pg-configure: ../tmp_install/build/Makefile
|
||||
|
||||
# this makefile would set env variables that would interfere with postgres build
|
||||
# preventing it from finding autogenerated headers. Hence 'env -i'
|
||||
pg-build: pg-configure
|
||||
env -i make -j8 -C ../tmp_install/build
|
||||
|
||||
postgres: pg-build
|
||||
mkdir -p ../tmp_install/log
|
||||
env -i make -C ../tmp_install/build \
|
||||
DESTDIR=/Users/stas/code/postgres/tmp_install install \
|
||||
> /Users/stas/code/postgres/tmp_install/log/install.log 2>&1
|
||||
41
build.rs
Normal file
41
build.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Triggers postgres build if there is no postgres binary present at
|
||||
// 'REPO_ROOT/tmp_install/bin/postgres'.
|
||||
//
|
||||
// I can see a lot of disadvantages with such automatization and main
|
||||
// advantage here is ability to build everything and run integration tests
|
||||
// in a bare repo by running 'cargo test'.
|
||||
//
|
||||
// We can interceipt whether it is debug or release build and run
|
||||
// corresponding pg build. But it seems like an overkill for now.
|
||||
//
|
||||
// Problem #1 -- language server in my editor likes calling 'cargo build'
|
||||
// by himself. So if I delete tmp_install directory it would magically reappear
|
||||
// after some time. During this compilation 'cargo build' may whine about
|
||||
// "waiting for file lock on build directory".
|
||||
//
|
||||
// Problem #2 -- cargo build would run this only if something is changed in
|
||||
// the crate.
|
||||
//
|
||||
// And generally speaking postgres is not a build dependency for the pageserver,
|
||||
// just for integration tests. So let's not mix that. I'll leave this file in
|
||||
// place for some time just in case if anybody would start doing the same.
|
||||
//
|
||||
|
||||
// use std::path::Path;
|
||||
// use std::process::{Command};
|
||||
|
||||
fn main() {
|
||||
// // build some postgres if it is not done none yet
|
||||
// if !Path::new("../tmp_install/bin/postgres").exists() {
|
||||
// let make_res = Command::new("make")
|
||||
// .arg("postgres")
|
||||
// .env_clear()
|
||||
// .status()
|
||||
// .expect("failed to execute 'make postgres'");
|
||||
|
||||
// if !make_res.success() {
|
||||
// panic!("postgres build failed");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -45,10 +45,10 @@ impl ComputeControlPlane {
|
||||
pub fn local() -> ComputeControlPlane {
|
||||
// postgres configure and `make temp-install` are using this path
|
||||
let pg_install_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../build/tmp_install/usr/local/pgsql");
|
||||
.join("../tmp_install/");
|
||||
|
||||
let work_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../tmp_check/zenith");
|
||||
.join("tmp_install/");
|
||||
|
||||
ComputeControlPlane {
|
||||
pg_install_dir: pg_install_dir,
|
||||
@@ -190,7 +190,6 @@ impl PostgresNode {
|
||||
}
|
||||
|
||||
impl Drop for PostgresNode {
|
||||
|
||||
// destructor to clean up state after test is done
|
||||
// TODO: leave everything in place if test is failed
|
||||
// TODO: put logs to a separate location to run `tail -F` on them
|
||||
|
||||
Reference in New Issue
Block a user