Skip to content
Merged
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: 4 additions & 1 deletion .github/workflows/internal-testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
run: |
git submodule update --init --checkout tests/integration/tests/curl/repo
git submodule update --init --checkout tests/integration/tests/json-c/repo
git submodule update --init --checkout tests/integration/tests/libgit2/repo
git submodule update --init --checkout tests/integration/tests/lua/repo
git submodule update --init --checkout tests/integration/tests/nginx/repo
git submodule update --init --checkout tests/integration/tests/zstd/repo
Expand Down Expand Up @@ -75,6 +76,7 @@ jobs:
sudo apt-get -qq install \
bear \
build-essential \
cmake \
libbrotli-dev \
libbz2-dev \
libclang-${{ matrix.clang-version }}-dev \
Expand All @@ -91,6 +93,7 @@ jobs:
librtmp-dev \
libtool \
libzstd-dev \
pkg-config \
rcs \
tcl-dev \
tk-dev \
Expand Down Expand Up @@ -125,7 +128,7 @@ jobs:
export PATH=$PWD/target/release:$PWD/c2rust-postprocess:$HOME/.local/bin:$PATH
echo "PATH=$PATH"
export C2RUST_DIR=$PWD
./tests/integration/test.py curl json-c lua nginx zstd libxml2 python2 libmcs
./tests/integration/test.py curl json-c libgit2 lua nginx zstd libxml2 python2 libmcs

- uses: actions/upload-artifact@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@
path = tests/integration/tests/libmcs/repo
url = https://gitlab.com/gtd-gmbh/libmcs
update = none
[submodule "tests/integration/tests/libgit2"]
path = tests/integration/tests/libgit2/repo
url = https://github.com/libgit2/libgit2
ignore = all
update = none
33 changes: 33 additions & 0 deletions tests/integration/tests/libgit2/cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"
LOG_FILE="$(basename "$0")".log
BUILD_DIR="$SCRIPT_DIR/repo/build"

rm -f compile_commands.json

cmake -S "$SCRIPT_DIR/repo" -B "$BUILD_DIR" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTS=ON \
-DBUILD_CLI=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_FUZZERS=OFF \
-DUSE_HTTPS=OFF \
-DUSE_SSH=OFF \
-DUSE_SHA256=builtin \
-DUSE_HTTP_PARSER=builtin \
-DREGEX_BACKEND=builtin \
-DUSE_BUNDLED_ZLIB=ON \
-DUSE_NTLMCLIENT=OFF \
-DUSE_ICONV=OFF \
2>&1 | tee "$LOG_FILE"

# The test runner expects compile_commands.json in the fixture directory.
ln -sf repo/build/compile_commands.json compile_commands.json
Comment thread
thedataking marked this conversation as resolved.

# clar generates `clar_suite.h` at build time, so the test sources can't be
# transpiled until the test target is built.
cmake --build "$BUILD_DIR" --target libgit2_tests --parallel "$(nproc)" \
2>&1 | tee -a "$LOG_FILE"
34 changes: 34 additions & 0 deletions tests/integration/tests/libgit2/conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
requirements:
ubuntu:
apt:
packages:
- cmake
- pkg-config

transpile:
autogen: true
binary: main # clar test runner's `main()` lives in tests/clar/main.c
tflags: --reorganize-definitions --disable-refactoring
Comment thread
thedataking marked this conversation as resolved.
# libgit2 builds its tests with GIT_DEPRECATE_HARD but not the library
# itself (which implements the deprecated APIs), so the same struct has two
# incompatible declarations across TUs (e.g. git_remote_callbacks.update_tips
# vs .reserved_update_tips). That breaks the refactor stage's
# reorganize_definitions pass, which merges declarations by name. Undefine
# the macro during transpilation so every TU sees one consistent view; the
# structs are layout-identical and the tests don't use deprecated APIs.
cflags: -UGIT_DEPRECATE_HARD

cargo.transpile:
autogen: true

refactor:
autogen: true
transforms:
- rename_unnamed
- reorganize_definitions
- shorten_imported_paths
- remove_unused_labels
- remove_literal_suffixes

cargo.refactor:
autogen: true
1 change: 1 addition & 0 deletions tests/integration/tests/libgit2/repo
Submodule repo added at f71642
8 changes: 8 additions & 0 deletions tests/integration/tests/libgit2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e; set -o pipefail

SCRIPT_DIR="$(cd "$(dirname "$0" )" && pwd)"

(cd "$SCRIPT_DIR/repo" && \
cargo run --release 2>&1 \
| tee "$SCRIPT_DIR/$(basename "$0")".log)
Loading