Skip to content

Commit

Permalink
Modify scripts for running FFmpeg tests from WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhex committed Dec 23, 2024
1 parent 42980a6 commit 35e8510
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 53 deletions.
4 changes: 3 additions & 1 deletion .github/scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ CCACHE_DIR_PATH=${CCACHE_DIR_PATH:-$ROOT_PATH/ccache}
ARTIFACT_PATH=${ARTIFACT_PATH:-$ROOT_PATH/artifact}
BUILD_MAKE_OPTIONS=${BUILD_MAKE_OPTIONS:-V=1 -j$(nproc)}
BUILD_CMAKE_OPTIONS=${BUILD_CMAKE_OPTIONS:---verbose -j$(nproc)}
TEST_MAKE_OPTIONS=${TEST_CMAKE_OPTIONS:-V=1 -k -j$(nproc)}
TEST_CMAKE_OPTIONS=${TEST_CMAKE_OPTIONS:---verbose --output-on-failure -j$(nproc)}
TOOLCHAIN_PATH=${TOOLCHAIN_PATH:-~/cross-$TOOLCHAIN_NAME}
TOOLCHAIN_FILE=${TOOLCHAIN_FILE:-$ROOT_PATH/.github/cmake/$TARGET.cmake}
Expand Down Expand Up @@ -94,7 +95,8 @@ LIBJPEG_TURBO_TESTS_PATH=${LIBJPEG_TURBO_TESTS_PATH:-$LIBJPEG_TURBO_BUILD_PATH}
FFMPEG_REPO=${FFMPEG_REPO:-FFmpeg/FFmpeg}
FFMPEG_BRANCH=${FFMPEG_BRANCH:-release/6.1}
FFMPEG_PATH=${FFMPEG_PATH:-~/ffmpeg}
FFMPEG_TESTS_PATH=${FFMPEG_TESTS_PATH:-~/ffmpeg-tests}
FFMPEG_BUILD_PATH=${FFMPEG_BUILD_PATH:-$BUILD_PATH/ffmpeg}
FFMPEG_TESTS_PATH=${FFMPEG_TESTS_PATH:-$FFMPEG_BUILD_PATH}

TESTS_PATH=${TESTS_PATH:-$ROOT_PATH/tests/build/bin/}
TESTS_PACKAGE_NAME=${TESTS_PACKAGE_NAME:-$TOOLCHAIN_NAME-tests.tar.gz}
Expand Down
21 changes: 14 additions & 7 deletions .github/scripts/ffmpeg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source `dirname ${BASH_SOURCE[0]}`/../config.sh

FFMPEG_BUILD_PATH=$BUILD_PATH/ffmpeg
FFMPEG_SOURCE_PATH=$SOURCE_PATH/ffmpeg

mkdir -p $FFMPEG_BUILD_PATH
Expand Down Expand Up @@ -33,11 +32,19 @@ echo "::group::Build FFmpeg"
make $BUILD_MAKE_OPTIONS
echo "::endgroup::"

echo "::group::Build FFmpeg tests"
make fate-rsync SAMPLES=samples
make fate | tee fate.log.orig
sed -E "/^warning: |^HOSTCC\t|^HOSTLD\t|^AS\t|^CC\t|^LD\t|TEST source|fate-source/d" fate.log.orig > fate.log
sed -i "s@$FFMPEG_SOURCE_PATH@\$FFMPEG_SOURCE_PATH@g" fate.log
echo "::endgroup::"
if [[ "$RUN_INSTALL" = 1 ]]; then
echo "::group::Install libjpeg-turbo"
make install
echo "::endgroup::"
fi

if [ ! -v WSLENV ]; then
echo "::group::Build FFmpeg tests"
make fate-rsync SAMPLES=samples
make fate | tee fate.log.orig
sed -E "/^warning: |^HOSTCC\t|^HOSTLD\t|^AS\t|^CC\t|^LD\t|TEST source|fate-source/d" fate.log.orig > fate.log
sed -i "s@$FFMPEG_SOURCE_PATH@\$FFMPEG_SOURCE_PATH@g" fate.log
echo "::endgroup::"
fi

echo 'Success!'
96 changes: 51 additions & 45 deletions .github/scripts/ffmpeg/execute-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source `dirname ${BASH_SOURCE[0]}`/../config.sh

SOURCE_PATH=`cygpath $SOURCE_PATH`
FFMPEG_SOURCE_PATH=$SOURCE_PATH/ffmpeg

# Path to the file with test names which should be skipped.
Expand All @@ -18,58 +17,65 @@ INCLUDE_TESTS=""
echo "::group::Test FFmpeg"
pushd $FFMPEG_TESTS_PATH

mkdir -p tests/data/fate

# fate.log usually contains 2 lines per test:
# TEST <testname>
# <command to execute>
# There might be multiple commands each on a new line.
IFS=$'\n'
SKIP=1
for i in $(cat fate.log); do
if [[ "$i" =~ ^(TEST) ]]; then
SKIP=0
TEST_NAME=${i##* }
COMMAND_NAME=$i

# Check if test should be skipped.
for SKIP_TEST in $SKIP_TESTS; do
if [[ "${TEST_NAME//[[:space:]]/}" == "${SKIP_TEST//[[:space:]]/}" ]]; then
if [ -v WSLENV ]; then
make $TEST_MAKE_OPTIONS fate-rsync SAMPLES=samples
make $TEST_MAKE_OPTIONS fate
else
FFMPEG_SOURCE_PATH=`cygpath $FFMPEG_SOURCE_PATH`

mkdir -p tests/data/fate

# fate.log usually contains 2 lines per test:
# TEST <testname>
# <command to execute>
# There might be multiple commands each on a new line.
IFS=$'\n'
SKIP=1
for i in $(cat fate.log); do
if [[ "$i" =~ ^(TEST) ]]; then
SKIP=0
TEST_NAME=${i##* }
COMMAND_NAME=$i

# Check if test should be skipped.
for SKIP_TEST in $SKIP_TESTS; do
if [[ "${TEST_NAME//[[:space:]]/}" == "${SKIP_TEST//[[:space:]]/}" ]]; then
SKIP=1
break
fi
done

# Check if test should be skipped by filter.
if [[ "$FILTER_TESTS" != "" && "$TEST_NAME" =~ $FILTER_TESTS ]]; then
SKIP=1
break
fi
done

# Check if test should be skipped by filter.
if [[ "$FILTER_TESTS" != "" && "$TEST_NAME" =~ $FILTER_TESTS ]]; then
SKIP=1
# Check if test should be included.
if [[ "$INCLUDE_TESTS" != "" && "$TEST_NAME" =~ $INCLUDE_TESTS ]]; then
SKIP=0
fi

[[ "$SKIP" == 1 ]] && echo SKIP $TEST_NAME || echo TEST $TEST_NAME
continue
fi

# Check if test should be included.
if [[ "$INCLUDE_TESTS" != "" && "$TEST_NAME" =~ $INCLUDE_TESTS ]]; then
if [[ "$i" =~ ^(GEN|COPY) ]]; then
SKIP=0
COMMAND_NAME=$i
echo $COMMAND_NAME
continue
fi

# If test was skipped in previous line.
if [[ "$SKIP" == 1 ]]; then
continue
fi

[[ "$SKIP" == 1 ]] && echo SKIP $TEST_NAME || echo TEST $TEST_NAME
continue
fi

if [[ "$i" =~ ^(GEN|COPY) ]]; then
SKIP=0
COMMAND_NAME=$i
echo $COMMAND_NAME
continue
fi

# If test was skipped in previous line.
if [[ "$SKIP" == 1 ]]; then
continue
fi

COMMAND=$i
echo $COMMAND
eval $COMMAND || { echo FAILED $COMMAND_NAME; exit 1; }
done
COMMAND=$i
echo $COMMAND
eval $COMMAND || { echo FAILED $COMMAND_NAME; exit 1; }
done
fi

popd
echo "::endgroup::"
Expand Down

0 comments on commit 35e8510

Please sign in to comment.