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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ test-driver
src/dir-stamp
test/run_tests
unittest/run_tests
# Bootstrapped by ext-deps/bootstrap_rapidcheck.sh; not part of the tree.
/ext-deps/rapidcheck/
.cache
.clang-format
.clang-tidy
Expand Down
53 changes: 53 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ COMMON_OBJS = \
tools/ipc_frame_ug.o \
tools/ipc_frame_unix.o \
tools/ipc_frame.o \
src/utils/alpha_blend.o \
src/utils/audio_buffer.o \
src/utils/overlay_config.o \
src/utils/overlay_layout.o \
src/utils/overlay_pam.o \
src/utils/overlay_scale.o \
src/utils/overlay_soft_edge.o \
src/utils/overlay_watch.o \
src/utils/color_out.o \
src/utils/config_file.o \
src/utils/dictionary.o \
Expand Down Expand Up @@ -212,6 +219,13 @@ TEST_OBJS = $(COMMON_OBJS) \
@TEST_OBJS@ \
test/codec_conversions_test.o \
test/ff_codec_conversions_test.o \
test/test_alpha_blend.o \
test/test_overlay_config.o \
test/test_overlay_layout.o \
test/test_overlay_pam.o \
test/test_overlay_scale.o \
test/test_overlay_soft_edge.o \
test/test_overlay_watch.o \
test/get_framerate_test.o \
test/gpujpeg_test.o \
test/libavcodec_test.o \
Expand Down Expand Up @@ -530,6 +544,45 @@ configure-messages:
tests: $(TEST_TARGET)
@export DYLD_LIBRARY_PATH=$(MY_DYLD_LIBRARY_PATH); $(TEST_TARGET)

.PHONY: e2e-tests
e2e-tests: $(TARGET)
@$(srcdir)/test/run_overlay_e2e.sh

# RapidCheck property-based tests for the overlay/alpha-blend code.
# Built only when configure --enable-rapidcheck succeeds (the conditional
# is set up in configure.ac and surfaces here as @HAVE_RAPIDCHECK_TRUE@).
@HAVE_RAPIDCHECK_TRUE@RAPIDCHECK_CFLAGS = @RAPIDCHECK_CFLAGS@
@HAVE_RAPIDCHECK_TRUE@RAPIDCHECK_CXXFLAGS = $(CXXFLAGS) $(RAPIDCHECK_CFLAGS) $(INC)
@HAVE_RAPIDCHECK_TRUE@RAPIDCHECK_TEST_SRCS = \
@HAVE_RAPIDCHECK_TRUE@ test/test_alpha_blend_rapidcheck.cpp \
@HAVE_RAPIDCHECK_TRUE@ test/test_overlay_rapidcheck.cpp \
@HAVE_RAPIDCHECK_TRUE@ test/test_soft_edges_rapidcheck.cpp \
@HAVE_RAPIDCHECK_TRUE@ test/test_file_monitoring_rapidcheck.cpp \
@HAVE_RAPIDCHECK_TRUE@ test/test_rapidcheck_main.cpp
@HAVE_RAPIDCHECK_TRUE@RAPIDCHECK_TEST_OBJS = $(RAPIDCHECK_TEST_SRCS:.cpp=.o)

@HAVE_RAPIDCHECK_TRUE@test/%_rapidcheck.o: test/%_rapidcheck.cpp
@HAVE_RAPIDCHECK_TRUE@ $(MKDIR_P) $$(dirname $@)
@HAVE_RAPIDCHECK_TRUE@ $(CXX) $(RAPIDCHECK_CXXFLAGS) -MD -c $< -o $@
@HAVE_RAPIDCHECK_TRUE@ $(POSTPROCESS_DEPS)

@HAVE_RAPIDCHECK_TRUE@test/test_rapidcheck_main.o: test/test_rapidcheck_main.cpp
@HAVE_RAPIDCHECK_TRUE@ $(MKDIR_P) $$(dirname $@)
@HAVE_RAPIDCHECK_TRUE@ $(CXX) $(RAPIDCHECK_CXXFLAGS) -MD -c $< -o $@
@HAVE_RAPIDCHECK_TRUE@ $(POSTPROCESS_DEPS)

@HAVE_RAPIDCHECK_TRUE@bin/rapidcheck_tests: $(RAPIDCHECK_TEST_OBJS) \
@HAVE_RAPIDCHECK_TRUE@ src/utils/alpha_blend.o src/color_space.o \
@HAVE_RAPIDCHECK_TRUE@ src/utils/overlay_layout.o \
@HAVE_RAPIDCHECK_TRUE@ src/utils/overlay_soft_edge.o \
@HAVE_RAPIDCHECK_TRUE@ src/utils/overlay_watch.o
@HAVE_RAPIDCHECK_TRUE@ $(CXX) $(CXXFLAGS) $(RAPIDCHECK_CFLAGS) -o $@ $^ \
@HAVE_RAPIDCHECK_TRUE@ ./ext-deps/rapidcheck/build/librapidcheck.a -pthread

@HAVE_RAPIDCHECK_TRUE@.PHONY: rapidcheck-tests
@HAVE_RAPIDCHECK_TRUE@rapidcheck-tests: bin/rapidcheck_tests
@HAVE_RAPIDCHECK_TRUE@ @./bin/rapidcheck_tests

.PHONY: check
check: tests
@$(srcdir)/data/scripts/check.sh "$(TARGET)" "$(REFLECTOR_TARGET)"
Expand Down
35 changes: 35 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2795,6 +2795,40 @@ if test "$found_zfec" = yes; then
fi
ENSURE_FEATURE_PRESENT([$zfec_req], [$found_zfec], [Zfec not found])

# -------------------------------------------------------------------------------------------------
# RapidCheck — property-based testing for the overlay/alpha-blend code.
# Build is opt-in (--enable-rapidcheck); ext-deps/bootstrap_rapidcheck.sh
# fetches and statically builds it under ext-deps/rapidcheck without
# touching the system. A system pkg-config install is also accepted.

AC_ARG_ENABLE(rapidcheck,
AS_HELP_STRING([--enable-rapidcheck], [enable RapidCheck property-based testing]),
[rapidcheck_req=$enableval],
[rapidcheck_req=auto])

rapidcheck=no
if test "$rapidcheck_req" != no; then
if test -f "$srcdir/ext-deps/rapidcheck/include/rapidcheck.h" || test -f "./ext-deps/rapidcheck/include/rapidcheck.h"; then
rapidcheck=yes
RAPIDCHECK_CFLAGS="-I$srcdir/ext-deps/rapidcheck/include"
else
PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck], [rapidcheck=yes], [
AC_CHECK_HEADER([rapidcheck.h], [
rapidcheck=yes
RAPIDCHECK_CFLAGS=""
])
])
fi

if test "$rapidcheck" = yes; then
AC_DEFINE([HAVE_RAPIDCHECK], [1], [RapidCheck is available])
AC_SUBST(RAPIDCHECK_CFLAGS)
fi
fi
ENSURE_FEATURE_PRESENT([$rapidcheck_req], [$rapidcheck],
[RapidCheck not found. Run ext-deps/bootstrap_rapidcheck.sh or install system-wide.])
AM_CONDITIONAL([HAVE_RAPIDCHECK], [test "$rapidcheck" = yes])

# -------------------------------------------------------------------------------------------------
#
# Jack stuff
Expand Down Expand Up @@ -3633,6 +3667,7 @@ if test "$build_default" != no || test "$req_files" = all; then
src/vo_postprocess/deinterlace.o
src/vo_postprocess/delay.o
src/vo_postprocess/interlace.o
src/vo_postprocess/overlay.o
src/vo_postprocess/split.o
src/vo_postprocess/temporal-deint.o
src/vo_postprocess/temporal_3d.o
Expand Down
53 changes: 53 additions & 0 deletions ext-deps/bootstrap_rapidcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
# Bootstrap script for RapidCheck - property-based testing for C++
#
# This script downloads and prepares RapidCheck for static linking
# with UltraGrid without requiring system-wide installation.

set -e

SCRIPT_DIR=$(dirname "$0")
RAPIDCHECK_DIR="$SCRIPT_DIR/rapidcheck"
# Pinned to a known-good commit so re-runs (and CI) get a reproducible
# build. The upstream has no tags; bump this when picking up a fix.
RAPIDCHECK_REF="b2d9ed2dddefc4b84318d664b4f221eb792d89c7"

echo "Bootstrapping RapidCheck..."

# Clean existing directory if present
if [ -d "$RAPIDCHECK_DIR" ]; then
echo "Removing existing RapidCheck directory..."
rm -rf "$RAPIDCHECK_DIR"
fi

# Clone RapidCheck
echo "Cloning RapidCheck @ $RAPIDCHECK_REF..."
git clone https://github.com/emil-e/rapidcheck.git "$RAPIDCHECK_DIR"
cd "$RAPIDCHECK_DIR"
git checkout --quiet "$RAPIDCHECK_REF"

# Build RapidCheck as a static library
echo "Building RapidCheck static library..."
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DRC_ENABLE_TESTS=OFF -DRC_ENABLE_EXAMPLES=OFF
make -j4

cd ..

# Create a pkg-config file for easier integration
cat > rapidcheck.pc << EOF
prefix=$RAPIDCHECK_DIR
includedir=\${prefix}/include
libdir=\${prefix}/build

Name: RapidCheck
Description: Property-based testing for C++
Version: 0.0.0
Cflags: -I\${includedir}
Libs: -L\${libdir} -lrapidcheck
EOF

echo "RapidCheck bootstrapped successfully!"
echo "To use in configure:"
echo " PKG_CONFIG_PATH=$RAPIDCHECK_DIR:\$PKG_CONFIG_PATH ./configure"
Loading