Add first scripts
This commit is contained in:
parent
c462076802
commit
cbccff8cc8
3 changed files with 99 additions and 0 deletions
29
env
Normal file
29
env
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
|
|
||||||
|
if [ ! -d "$base_dir/glibc" ] || [ ! -d "$base_dir/eh_frame_check" ] \
|
||||||
|
|| [ ! -d "$base_dir/venv" ]; then
|
||||||
|
>&2 echo "The environment is not yet configured. Please run " \
|
||||||
|
"\`setup_env.sh\` first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
glibc_base="$base_dir/glibc/build"
|
||||||
|
|
||||||
|
python_version="$(ls -1 "$base_dir/venv/lib/" | grep python | head -n 1)"
|
||||||
|
if [ -z "$python_version" ] ; then
|
||||||
|
>&2 echo "Virtualenv has no python installed. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
python_base="$base_dir/venv/lib/$python_version/site-packages"
|
||||||
|
|
||||||
|
export LIB_PATH="${glibc_base}:${glibc_base}/math:${glibc_base}/elf:${glibc_base}/dlfcn:${glibc_base}/nss:${glibc_base}/nis:${glibc_base}/rt:${glibc_base}/resolv:${glibc_base}/crypt:${glibc_base}/mathvec:${glibc_base}/support:${glibc_base}/nptl"
|
||||||
|
export GCONV_PATH=${glibc_base}/iconvdata
|
||||||
|
export LOCPATH=${glibc_base}/localedata
|
||||||
|
export LC_ALL=C
|
||||||
|
export PYTHONPATH="$PYTHONPATH:$python_base"
|
||||||
|
|
||||||
|
export PS1="(efc_env) $PS1"
|
||||||
|
|
||||||
|
unset base_dir glibc_base python_version python_base
|
28
run_single_test.sh
Normal file
28
run_single_test.sh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
|
cd "$base_dir"
|
||||||
|
|
||||||
|
source ./env
|
||||||
|
|
||||||
|
if [ "$#" -le 1 ] ; then
|
||||||
|
>&2 echo -e "Missing argument: test name. Usage example:\n" \
|
||||||
|
"$0 math/test-matherr"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
test_file="$1"
|
||||||
|
|
||||||
|
glibc_base="$base_dir/glibc/build"
|
||||||
|
test_path="$glibc_base/$test_file"
|
||||||
|
|
||||||
|
eh_frame_check="$base_dir/eh_frame_check/testing/eh_frame_check.py"
|
||||||
|
|
||||||
|
if [ ! -x "$test_path" ] ; then
|
||||||
|
>&2 echo "File $test_path does not exist or is not executable."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gdb -q -x "$eh_frame_check" \
|
||||||
|
-args $glibc_base/elf/ld-linux-x86-64.so.2 \
|
||||||
|
--library-path "$LIB_PATH" \
|
||||||
|
"$test_path"
|
42
setup_env.sh
Normal file
42
setup_env.sh
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function status_update {
|
||||||
|
echo "### $1 ###"
|
||||||
|
}
|
||||||
|
|
||||||
|
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
|
cd "$base_dir"
|
||||||
|
|
||||||
|
# First, clone Francesco's eh_frame_check
|
||||||
|
status_update "Cloning eh_frame_check"
|
||||||
|
git clone https://github.com/francesco-zappa-nardelli/eh_frame_check/
|
||||||
|
|
||||||
|
# Then, clone glibc
|
||||||
|
status_update "Cloning glibc"
|
||||||
|
git clone git://sourceware.org/git/glibc.git glibc
|
||||||
|
|
||||||
|
# Install a virtualenv with required pip packages
|
||||||
|
status_update "Installing python virtualenv"
|
||||||
|
virtualenv -p python3 venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Compiling glibc
|
||||||
|
status_update "Compiling base glibc"
|
||||||
|
(
|
||||||
|
mkdir -p glibc/build/install
|
||||||
|
cd glibc/build
|
||||||
|
../configure --prefix=install
|
||||||
|
make
|
||||||
|
)
|
||||||
|
|
||||||
|
# Compiling testsuite
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
# Done!
|
||||||
|
status_update "All set!"
|
Loading…
Reference in a new issue