From 461f3d3ef06e167164bb44f26b884792c5fb575a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 26 Mar 2018 17:20:29 +0200 Subject: [PATCH] Add Makefile, fix multiple things Makefile: useful to run in parallel at no cost --- Makefile | 7 +++++++ env | 2 +- requirements.txt | 2 +- run_single_test.sh | 4 ++-- setup_env.sh | 12 +++++++++--- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4a7de64 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +TESTS := $(shell find "glibc/build/" -executable -name 'test-*' -or -executable -name 'tst-*') +TESTS_SUFFIX := $(TESTS:=.test) + +all: $(TESTS_SUFFIX) + +%.test: % + ./run_single_test.sh $< diff --git a/env b/env index 137290e..bd03a71 100755 --- a/env +++ b/env @@ -26,4 +26,4 @@ export PYTHONPATH="$PYTHONPATH:$python_base" export PS1="(efc_env) $PS1" -unset base_dir glibc_base python_version python_base +unset glibc_base python_version python_base diff --git a/requirements.txt b/requirements.txt index 80868f7..093ddd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ intervaltree==2.1.0 -pyelftools==0.24 +git+https://github.com/eliben/pyelftools.git sortedcontainers==1.5.9 diff --git a/run_single_test.sh b/run_single_test.sh index 19385e1..4416b6b 100755 --- a/run_single_test.sh +++ b/run_single_test.sh @@ -5,12 +5,12 @@ cd "$base_dir" source ./env -if [ "$#" -le 1 ] ; then +if [ "$#" -lt 1 ] ; then >&2 echo -e "Missing argument: test name. Usage example:\n" \ "$0 math/test-matherr" exit 1 fi -test_file="$1" +test_file="$(echo "$1" | sed 's|glibc/build/||')" glibc_base="$base_dir/glibc/build" test_path="$glibc_base/$test_file" diff --git a/setup_env.sh b/setup_env.sh index 0fb008e..095e92d 100755 --- a/setup_env.sh +++ b/setup_env.sh @@ -22,6 +22,10 @@ function gitclone { fi } +function do_make { + make $(MAKE_FLAGS) $1 +} + base_dir="$(dirname "$(readlink -f "$0")")" cd "$base_dir" @@ -42,12 +46,14 @@ source venv/bin/activate pip install -r requirements.txt || fail # Compiling glibc +install_dir="$base_dir/glibc/build/install" status_update "Compiling base glibc" ( mkdir -p glibc/build/install cd glibc/build - ../configure --prefix="$base_dir/glibc/build/install" || exit 1 - make || exit 1 + ../configure --prefix="$install_dir" || exit 1 + do_make || exit 1 + do_make install || exit 1 ) || fail # Compiling testsuite @@ -55,7 +61,7 @@ status_update "Compiling glibc testsuite" status_update "Feel free to go and drink some coffee now. This will take some time." ( cd glibc/build - make check || exit 1 + CPATH="$install_dir/include:$CPATH" do_make check || exit 1 ) || fail # Done!