jasper-software / jasper

Official Repository for the JasPer Image Coding Toolkit
http://www.ece.uvic.ca/~mdadams/jasper
Other
217 stars 103 forks source link

Tests were failing because file not found #348

Closed jennyfothergill closed 1 year ago

jennyfothergill commented 1 year ago

Hi there, Tests were failing for me when I tried to run ctest. Here's the error I'd get:

jasper/test/bin/utilities: line 115: : No such file or directory

After a lot of digging, I found that the associative array record wasn't being set by tcf_gettest() in utilities. I stumbled into a "fix" while I trying to figure out what was going on. By adding

echo "name?: ${$name[@]}"

before exiting out of the tcf_gettest function, record was set correctly and all the tests passed. I assume this is some bash wizardry related to global variable definitions, or it could just be a load-bearing echo. ;)

Anyway I'm happy to PR or provide more information to help you fix this in a more elegant way. Thanks!

mdadams commented 1 year ago

Please provide instructions on how to reproduce the problem. Also, information on your platform and software versions (e.g., Bash) are quite important as some versions of Bash do not support associative arrays.

jennyfothergill commented 1 year ago

Of course, here is what I ran:

cmake -H$SOURCE_DIR -B$BUILD_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DJAS_ENABLE_MULTITHREADING_SUPPORT=true -DJAS_ENABLE_LIBJPEG=true -DJAS_ENABLE_SHARED=true -DCMAKE_BUILD_TYPE=Release -DJAS_ENABLE_OPENGL=false
cmake --build $BUILD_DIR
cd $BUILD_DIR
ctest --output-on-failure

And here is my version of bash:

$ bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
mdadams commented 1 year ago

I cannot reproduce this problem on any of the systems that I use for development/testing. The JasPer software builds, installs, and passes the test suite on versions of Fedora, Ubuntu, MacOS, and Windows. Unless you can provide more specific details at to what exactly is failing and why as well as the details of the environment in which it is failing, there is nothing that I can do. Line 115 of the utilities file is the following:

local buffer=$("$imginfo" --enable-all-formats -q < "$file") || return 1

This does not match the line that you mentioned above (which was an "echo" command).

jennyfothergill commented 1 year ago

Yeah, that's the correct line which was failing in the original error. An echo showed the "file" variable was empty on my system. I walked back through how "file" was being set until I found the variable which was not being set--which happened to be "record". Adding the echo in the function where record is defined (tcf_gettest) sets it correctly. I wonder if this is because the name variable is set as local?

I am using Centos 7 with GNU bash 4.2.46.

mdadams commented 1 year ago

As I said before, unless you can provide more detailed information about the reason for the failure, there is nothing that I can do because I cannot reproduce the problem on any of the systems that I use.

mdadams commented 1 year ago

Since I have not received any additional information that would allow me to reproduce the problem, I am going to close this issue, as there is nothing that I can do if I have no idea what the cause of the problem is and I cannot reproduce it. (Perhaps, the problem is already fixed in newer versions of the software.)