Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testing #566

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ install(FILES "${FLIF_SRC_DIR}/../LICENSE" "${FLIF_SRC_DIR}/../LICENSE_Apache2"

enable_testing()
add_test(NAME libtest COMMAND libtest dummy.flif)
if(BUILD_STATIC_LIBS)
add_test(NAME libtest_static COMMAND libtest_static dummy.flif)
endif(BUILD_STATIC_LIBS)

if(UNIX)
add_test(NAME roundtrip1 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../tools/test-roundtrip.sh ${CMAKE_CURRENT_SOURCE_DIR}/../tools/2_webp_ll.png 2_webp_ll.flif decoded_2_webp_ll.png)
Expand Down
8 changes: 4 additions & 4 deletions tools/test-roundtrip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -ex

FLIF=$1
IN=$2
OUTF=$3
OUTP=$4
FLIF=./flif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using ./ the script will look for the binary in the same directory as itself, which is tools. That's not the case here – gitignore gives us a hint:

# binarys
src/flif

So by default you'll find the binary in src folder, not tools. I looked into my local copy (which I compiled previously) and sure enough, there it was. Hardcoding a path to a binary makes it impossible to use this script if the binary isn't stored there. If someone installed FLIF in their system by (sudo) make install, then the binary will be somewhere in system directories, so ./flif won't work in this case, too.

IN=$1
OUTF=$2
OUTP=$3

runtest() {
local encArgs=$1
Expand Down
12 changes: 6 additions & 6 deletions tools/test-roundtrip_anim.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/sh

# compare $1 (base name without .png extension, could be multiple frames) one by one to the rest of the arguments
function check {
check () {
one=$1*.png
for c in $one
do
if [[ $(compare -metric mepp $c $2 null: 2>&1) == "0 (0, 0)" ]]
if [ "$(compare -metric mepp $c $2 null: 2>&1)" = "0 (0, 0)" ]
then
#echo "OK-compare (identical decoded images)"
shift
Expand All @@ -21,9 +21,9 @@ function check {

set -ex

FLIF=$1
IN=$2
OUTF=$3
FLIF=./flif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above – this shouldn't be hardcoded, especially not in this way.

IN=$1
OUTF=$2

runtest() {
local encArgs=$1
Expand Down