Skip to content

Commit

Permalink
More thirdparty CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhsnn committed Nov 29, 2024
1 parent a77f10a commit d4283bc
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 6 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/linux_thirdparty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@ jobs:
strategy:
matrix:
include:
- thirdparty: test_cello
- thirdparty: test_curl
- thirdparty: test_doom
- thirdparty: test_git
- thirdparty: test_libpng
- thirdparty: test_libuev
- thirdparty: test_lua
- thirdparty: test_metalang99
- thirdparty: test_oniguruma_jq
- thirdparty: test_openssh
- thirdparty: test_openssl
- thirdparty: test_perl
- thirdparty: test_php
- thirdparty: test_postgres
- thirdparty: test_python
- thirdparty: test_qbe_hare
- thirdparty: test_sqlite
- thirdparty: test_tinycc
- thirdparty: test_toxcore
- thirdparty: test_toybox
- thirdparty: test_vim
- thirdparty: test_zlib
- thirdparty: test_zstd
- thirdparty: build_gcc
Expand All @@ -59,6 +72,6 @@ jobs:

- name: Run test
run: >
sudo docker run
debian_asan su non-root -c
sudo docker run debian_asan
su non-root -c
'bash "$0" "$1"' linux_thirdparty.bash ${{ matrix.thirdparty }}
12 changes: 10 additions & 2 deletions scripts/debian_asan.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-12 \
file binutils libc-dev libgcc-12-dev \
make cmake pkg-config \
autoconf autopoint automake gettext texinfo \
git curl ca-certificates \
python3 tcl-dev bison flex re2c \
libcurl4-openssl-dev libssl-dev libexpat1-dev zlib1g-dev libicu-dev \
libncurses-dev libreadline-dev libpsl-dev libffi-dev libxml2-dev libsqlite3-dev \
# build_gcc
libgmp-dev libmpfr-dev libmpc-dev \
autoconf autopoint automake gettext texinfo
# test_toxcore
libsodium-dev \
# test_perl:cpan/Socket/t/getaddrinfo.t
netbase

COPY . /work/slimcc
WORKDIR /work/slimcc
Expand All @@ -20,8 +25,11 @@ RUN apt-get -y autoremove gcc-12 && apt-get clean
ENV ASAN_OPTIONS=detect_leaks=0
ENV CC=/work/slimcc/slimcc_asan

RUN bash scripts/linux_thirdparty.bash install_libtool

RUN useradd -m non-root -s /bin/bash && \
su non-root -c "git config --global advice.detachedHead false" && \
mv scripts/linux*.bash /home/non-root
su non-root -c "git config --global init.defaultBranch init" && \
mv scripts/linux_thirdparty.bash /home/non-root

WORKDIR /home/non-root
128 changes: 126 additions & 2 deletions scripts/linux_thirdparty.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,40 @@ github_tar() {
}

github_clone() {
git clone --depth 1 --branch "$3" https://github.com/"$1"/"$2"
git clone --depth 1 --recurse-submodules --shallow-submodules --branch "$3" https://github.com/"$1"/"$2"
cd "$2"
}

git_fetch() {
mkdir -p "$3" && cd "$3"
git init
git remote add origin "$1"
git fetch --depth 1 origin "$2"
git checkout FETCH_HEAD
}

url_tar() {
mkdir -p "$2"
curl -fL "$1" | tar xz -C "$2" --strip-components=1
cd "$2"
}

install_libtool() {
url_tar https://ftp.gnu.org/gnu/libtool/libtool-2.5.4.tar.gz __libtool
fix_configure ./configure
fix_configure libltdl/configure
./configure
make -j2 install
cd ../ && rm -rf __libtool
}

# tests

test_cello() {
git_fetch https://github.com/orangeduck/Cello cbf055dda4efa0fb22286f12f24fada728cde8b3 cello
make check
}

test_curl() {
github_tar curl curl curl-8_10_1
sed -i 's/^if(MSVC OR CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")$/if (TRUE)/g' tests/CMakeLists.txt
Expand Down Expand Up @@ -61,10 +82,78 @@ test_libpng() {
make test
}

test_libuev() {
github_tar troglobit libuev v2.4.1
libtoolize
autoreconf -fi
fix_configure ./configure
./configure
make check
}

test_lua() {
url_tar https://lua.org/ftp/lua-5.4.7.tar.gz lua
cd src && make CC="$CC" linux-readline
url_tar https://www.lua.org/tests/lua-5.4.7-tests.tar.gz luatests
cd libs && make CC="$CC" && cd ../
../lua -e"_port=true" all.lua # assertion at files.lua:84 fail on CI
}

test_metalang99() {
github_tar hirrolot datatype99 v1.6.4
sh scripts/test-all.sh
github_tar hirrolot interface99 v1.0.1
sh scripts/test-all.sh
github_tar hirrolot metalang99 v1.13.3
sh scripts/test.sh
}

test_oniguruma_jq() {
git_fetch https://github.com/jqlang/jq 96e8d893c10ed2f7656ccb8cfa39a9a291663a7e jq
cd modules/

git_fetch https://github.com/kkos/oniguruma e0a8f04615ecc5bbae0bec8b007ecb4816966ae5 oniguruma
libtoolize
autoreconf -fi
fix_configure ./configure
CFLAGS=-fenable-universal-char ./configure
make check

cd ../../
libtoolize
autoreconf -fi
fix_configure ./configure
./configure
make check
}

test_openssh() {
github_tar openssh openssh-portable V_9_8_P1
./configure
make tests
make
make file-tests
# make t-exec ## "regress/agent-subprocess.sh" fail in CI
make interop-tests
make extra-tests
make unit
}

test_openssl() {
github_tar openssl openssl openssl-3.4.0
replace_line "#if !defined(__DJGPP__)" "#if 0" test/rsa_complex.c
./Configure
make test
}

test_perl() {
github_tar perl perl5 v5.40.0
sed -i "187i push(@file, '/usr/include/asm-generic/errno-base.h');" ext/Errno/Errno_pm.PL
sed -i "188i push(@file, '/usr/include/asm-generic/errno.h');" ext/Errno/Errno_pm.PL
# https://github.com/Perl/perl5/blob/80f266d3fc15255d56d2bebebceba52614f04943/.github/workflows/testsuite.yml#L810
export NO_NETWORK_TESTING=1
./Configure -des -Dcc="$CC" -Accflags=-fPIC -Alibs="-lpthread -ldl -lm -lcrypt -lutil -lc" \
-Alibpth="/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu"
make -j8 test
}

test_php() {
Expand Down Expand Up @@ -102,13 +191,48 @@ test_python() {
./python -m test --exclude "${skip_tests[@]}"
}

test_qbe_hare() {
git_fetch git://c9x.me/qbe.git 90050202f57b22243f5d3dd434a81df2f89de9ed qbe
make CC="$CC" check
url_tar https://git.sr.ht/~sircmpwn/harec/archive/0.24.2.tar.gz harec
mv configs/linux.mk config.mk
make CC="$CC" QBE=../qbe check
}

test_sqlite() {
github_tar sqlite sqlite version-3.47.1
fix_configure ./configure
CFLAGS=-D_GNU_SOURCE ./configure
make tcltest
}

test_tinycc() {
git_fetch https://repo.or.cz/tinycc.git 085e029f08c9b0b57632703df565efdbe2cd0c7f tinycc
./configure && make && cd tests/tests2/ && make
}

test_toxcore() {
github_clone TokTok c-toxcore v0.2.20
libtoolize
autoreconf -fi
fix_configure ./configure
./configure
make check
}

test_toybox() {
git_fetch https://github.com/landley/toybox fb3ca98e2faaa11512061cdd3fc946ddf0c2696b toybox
make CC="$CC" HOSTCC="$CC" defconfig
make CC="$CC" HOSTCC="$CC"
make CC="$CC" HOSTCC="$CC" tests
}

test_vim() {
github_tar vim vim v9.1.0891
./configure
make && make testtiny
}

test_zlib() {
github_tar madler zlib v1.3.1
./configure
Expand Down

0 comments on commit d4283bc

Please sign in to comment.