gphoto2 icon indicating copy to clipboard operation
gphoto2 copied to clipboard

tests/testsuite test037 requires that gphoto2 is built with libexif support

Open ndim opened this issue 3 years ago • 1 comments

Describe the bug

As described in https://github.com/gphoto/gphoto2/issues/420, the gphoto2 tests/testsuite bash script runs its test037 unconditionally, which means that the test suite requires that gphoto2 is built with libexif support.

However, the buildsystem and the gphoto2 source code still support building gphoto2 without libexif support.

libgphoto2 and gphoto2 version

[user@host gphoto2]$ ./_build/master/gphoto2/gphoto2 --version | tail -n3
gphoto2         2.5.27.1       gcc, popt(m), no exif, cdk, aa, jpeg, readline
libgphoto2      2.5.27         standard camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0         iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, ltdl, EXIF, USB, serial lockdev locking
[user@host gphoto2]$ git rev-parse HEAD
96dbd34de5393f6da6d402836af4aec1a7d9c573
[user@host gphoto2]$ 

To Reproduce Steps to reproduce the behavior:

  • run configure
  • If libexif has been detected by pkg-config during the configure run, remove the HAVE_LIBEXIF definition from config.h to trick the build into building without libexif support.
  • run make check
  • verify the make check has not updated config.h with an HAVE_LIBEXIF definition

Possible resolutions

Either

  • add a new feature to the tests/testsuite shell script to teach it about skipping some tests under some build conditions
  • turn building with libexif from optional to mandatory (looks easier to implement, and reduces the overall complexity of the build)

I do not want to make that decision on my own.

ndim avatar May 05 '21 10:05 ndim

OK, regarding easier to implement... well... teaching tests/testsuite to skip some tests if necessary is not that difficult.

Possible parts of an implementation:

  • AM_CONDITIONAL([LIBEXIF], [...]) in configure.ac
  • In tests/Makefile.am, if HAVE_EXIF else endif exporting an env var like SKIP_TESTS=test037 to the testsuite process, or TEST_FEATURES="exif foo bar".
  • The tests/data/*.param files could contain SKIP_UNLESS=exif which testsuite then needs to honor.
  • If the SKIP_UNLESS value threatens to need a boolean expression of TEST_FEATURES, I would tend towards implementing the boolean complexity using nested if HAVE_FOO AM_CONDITIONALs and then passing a single identifier string for that boolean expression via TEST_FEATURES, which would then be used as the value of SKIP_UNLESS.

If we anticipate other test cases which could make use of that kind of mechanism, I would implement it.

On the other hand, the goal of reducing build complexity would be best served by always requiring libexif.

ndim avatar May 05 '21 12:05 ndim