Skip to content

Commit

Permalink
Merge pull request #779 from g-maxime/mkv-blockadditions
Browse files Browse the repository at this point in the history
Add fields compare in policy checker
  • Loading branch information
JeromeMartinez authored May 27, 2024
2 parents d1ee3ad + 87768dd commit f7c5044
Show file tree
Hide file tree
Showing 30 changed files with 1,759 additions and 667 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/MediaConch_Checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
pip --disable-pip-version-check install git+https://github.com/vi/mkvparse.git
fi
if [ "$RUNNER_OS" == "macOS" ]; then
brew install automake libxslt sqlite jansson libevent qt@5 sfk xmlstarlet ffmpeg
brew install libtool automake libxslt sqlite jansson libevent qt@5 sfk xmlstarlet ffmpeg
sudo pip --disable-pip-version-check install --prefix /usr/local git+https://github.com/vi/mkvparse.git
fi
- name: Get ZenLib info
Expand Down Expand Up @@ -89,8 +89,8 @@ jobs:
- name: Configure GUI
run: |
cd Project/Qt
export PATH=/usr/local/opt/qt@5/bin:$PATH
./prepare INCLUDEPATH+=/usr/local/include CONFIG+=c++11 -after QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9 QMAKE_LFLAGS-=-Wl,-ld_classic
export PATH=/opt/homebrew/opt/qt@5/bin:$PATH
./prepare CONFIG+=c++11 -after QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9 QMAKE_LFLAGS-=-Wl,-ld_classic
- name: Build GUI
run: |
cd Project/Qt
Expand Down
3 changes: 2 additions & 1 deletion Project/GNU/CLI/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ TESTS = \
test/simple.sh \
test/filename.sh \
test/test_mk.sh \
test/test_ffv1.sh
test/test_ffv1.sh \
test/test_policy.sh

SAMPLES_DIR = test/SampleFiles

Expand Down
45 changes: 45 additions & 0 deletions Project/GNU/CLI/test/test_policy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

PATH_SCRIPT=$(dirname "${0}")
. "${PATH_SCRIPT}/utils.sh"

FILES_DIRECTORY="${PATH_SCRIPT}/SampleFiles/PolicyTestFiles"

MC="${PWD}/mediaconch"

RCODE=0

while read LINE ; do
POLICY="$(echo "${LINE}" | cut -d':' -f1)"
FILE="$(echo "${LINE}" | cut -d':' -f2)"
OUTCOME="$(echo "${LINE}" | cut -d':' -f3)"
TEST="${POLICY}:$(basename "${FILE}"):${OUTCOME}"

if [ ! -e "${FILES_DIRECTORY}/Policy/${POLICY}" ] ; then
echo "NOK: ${TEST}/${POLICY}, file not found" >&9
RCODE=1
continue
fi

if [ ! -e "${FILES_DIRECTORY}/${FILE}" ] ; then
echo "NOK: ${TEST}/${FILE}, file not found" >&9
RCODE=1
continue
fi

pushd "${FILES_DIRECTORY}" >/dev/null 2>&1
DATA="$(${MC} -p Policy/${POLICY} -fx ${FILE})"

T1=`echo "${DATA}" | xmllint --xpath \
"string(/*[local-name()='MediaConch']/*[local-name()='media']/*[local-name()='policy']/@outcome)" -`

if [ "${T1}" == "${OUTCOME}" ] ; then
echo "OK: ${TEST}" >&9
else
echo "NOK: ${TEST}, failed" >&9
RCODE=1
fi
popd >/dev/null 2>&1
done < "${PATH_SCRIPT}/test_policy.txt"

exit ${RCODE}
7 changes: 7 additions & 0 deletions Project/GNU/CLI/test/test_policy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
value.xml:Matroska/videofirst.mkv:pass
value.xml:Matroska/audiofirst.mkv:fail
info.xml:Matroska/audiofirst.mkv:info
warn.xml:Matroska/audiofirst.mkv:warn
levelcap.xml:Matroska/audiofirst.mkv:info
operators.xml:Matroska/videofirst.mkv:pass
mmt.xml:Matroska/videofirst.mkv:pass
Loading

0 comments on commit f7c5044

Please sign in to comment.