Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/internal-testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
run: |
sudo apt-get -qq update
sudo apt-get -qq install \
bear \
build-essential \
libbrotli-dev \
libbz2-dev \
Expand Down Expand Up @@ -127,9 +128,7 @@ jobs:
export PATH=$PWD/target/release:$PWD/c2rust-postprocess:$HOME/.local/bin:$PATH
echo "PATH=$PATH"
export C2RUST_DIR=$PWD
# Needs to be run from `tests/integration/` (or further inside)
# to correctly load the `pyproject.toml`.
(cd tests/integration && ./test.py curl json-c lua nginx zstd libxml2 python2 libmcs)
./tests/integration/test.py curl json-c lua nginx zstd libxml2 python2 libmcs

- uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 0 additions & 10 deletions tests/integration/pyproject.toml

This file was deleted.

11 changes: 10 additions & 1 deletion tests/integration/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/usr/bin/env -S uv run
#!/usr/bin/env -S uv run --script

# /// script
# requires-python = ">=3.12"
# dependencies = [
# "distro>=1.9.0",
# "jinja2>=3.1.6",
# "pyyaml>=6.0.3",
# ]
# ///

import argparse

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tests/conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ requirements:
- make
- cmake
- cargo
- intercept-build
- bear
7 changes: 4 additions & 3 deletions tests/integration/tests/curl/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
make -C "$SCRIPT_DIR/repo" clean && rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j`nproc` 2>&1 \
bear -- make -C "$SCRIPT_DIR/repo" -j`nproc` 2>&1 \
| tee `basename "$0"`.log

# remove compile_commands entries where `arguments` contains `UNITTEST`
Expand All @@ -15,8 +15,9 @@ cp "$tmp" $SCRIPT_DIR/compile_commands.json

# work around https://github.com/immunant/c2rust/issues/1319
#
# remove compile_commands where `file` starts with `../lib/curlx` because clang-15 may pick the wrong compile_commands.json
# remove compile_commands where `file` is under `lib/curlx` because clang-15 may pick the wrong compile_commands.json
# entry which causes the transpiler to fail because it doesn't get the right include paths. clang-18 does not seem to have
# this problem which indicates the problem is not in the transpiler.
jq 'map(select(.file | startswith("../lib/curlx") | not))' $SCRIPT_DIR/compile_commands.json > "$tmp"
# (`bear` records `file` as an absolute path, so match the path component rather than a relative prefix.)
jq 'map(select(.file | contains("lib/curlx") | not))' $SCRIPT_DIR/compile_commands.json > "$tmp"
mv "$tmp" $SCRIPT_DIR/compile_commands.json
2 changes: 1 addition & 1 deletion tests/integration/tests/json-c/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
(cd "${SCRIPT_DIR}"
make -C repo clean && rm -f compile_commands.json)
(cd "${SCRIPT_DIR}"
intercept-build make -C repo -j`nproc`) 2>&1 | tee `basename "$0"`.log
bear -- make -C repo -j`nproc`) 2>&1 | tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/libmcs/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

make -C "$SCRIPT_DIR/repo" clean
rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j$(nproc) &> $(basename "$0").log
bear -- make -C "$SCRIPT_DIR/repo" -j$(nproc) &> $(basename "$0").log
2 changes: 1 addition & 1 deletion tests/integration/tests/libxml2/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
make -C "$SCRIPT_DIR/repo" clean && rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j`nproc` runtest 2>&1 \
bear -- make -C "$SCRIPT_DIR/repo" -j`nproc` runtest 2>&1 \
| tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/lua/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
make -C "$SCRIPT_DIR/repo" clean && rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j`nproc` \
bear -- make -C "$SCRIPT_DIR/repo" -j`nproc` \
MYCFLAGS="-std=c99 -DLUA_USE_LINUX -DLUA_USE_READLINE -DLUA_USE_JUMPTABLE=0" \
| tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/nginx/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j`nproc` \
bear -- make -C "$SCRIPT_DIR/repo" -j`nproc` \
CFLAGS="-std=c99 -O0" 2>&1 \
| tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/python2/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export EXTRA_CFLAGS="-std=c99"

(cd "$SCRIPT_DIR"
make -C repo clean && rm -f compile_commands.json
intercept-build make -C repo -j`nproc` python) 2>&1 | tee `basename "$0"`.log
bear -- make -C repo -j`nproc` python) 2>&1 | tee `basename "$0"`.log
# make rest to properly run python
(cd "$SCRIPT_DIR"
make -C repo -j`nproc`) 2>&1 | tee -a `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/redis/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
make -C "$SCRIPT_DIR/repo" distclean && rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo" -j`nproc` 2>&1 \
bear -- make -C "$SCRIPT_DIR/repo" -j`nproc` 2>&1 \
| tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/ruby/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"

(cd "$SCRIPT_DIR"
make -C "$SCRIPT_DIR/repo" clean && rm -f compile_commands.json
intercept-build make -C repo -j`nproc` miniruby) 2>&1 | tee `basename "$0"`.log
bear -- make -C repo -j`nproc` miniruby) 2>&1 | tee `basename "$0"`.log
2 changes: 1 addition & 1 deletion tests/integration/tests/snudown/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
(cd "$SCRIPT_DIR/repo" && python2 setup.py clean --all && rm -f compile_commands.json)
(cd "$SCRIPT_DIR/repo" && intercept-build python2 setup.py build 2>&1 \
(cd "$SCRIPT_DIR/repo" && bear -- python2 setup.py build 2>&1 \
| tee ../`basename "$0"`.log)
mv "$SCRIPT_DIR/repo/compile_commands.json" "$SCRIPT_DIR/"
2 changes: 1 addition & 1 deletion tests/integration/tests/zstd/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ TARGET=fullbench

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
make -C "$SCRIPT_DIR/repo" clean && rm -f compile_commands.json
intercept-build make -C "$SCRIPT_DIR/repo/tests" -j`nproc` $TARGET 2>&1 \
bear -- make -C "$SCRIPT_DIR/repo/tests" -j`nproc` $TARGET 2>&1 \
| tee `basename "$0"`.log
Loading
Loading