linux-test-project / lcov

LCOV
GNU General Public License v2.0
867 stars 235 forks source link

2.0: test suite is failing with `Could not create directory src/: File exists` #251

Closed kloczek closed 1 month ago

kloczek commented 7 months ago
+ cd lcov-2.0
+ /usr/bin/make -O -j48 V=1 VERBOSE=1 test
if [ "x" != 'x' ] && [ ! -d tests/ ]; then \
  mkdir tests/ ; \
fi
/home/tkloczko/rpmbuild/BUILD/lcov-2.0/tests//bin/mkinfo: Could not create directory src/: File exists
make[1]: *** [common.mak:75: /home/tkloczko/rpmbuild/BUILD/lcov-2.0/tests/part1.info] Error 17
make[1]: *** Waiting for unfinished jobs....
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
Creating coverage files (2 tests, 5 source files)
  Source tree ......... done (950 lines, 50 functions, 3428 branches)
  Full coverage ....... done
  Target coverage ..... done
  Partial coverage .... done
  Zero coverage ....... done
make: *** [Makefile:213: check] Error 2
henry2cox commented 7 months ago

Can you also take a look at your current build area to see what 'src/' is?
I took a look at the code; it appears that it would need to be a file (not directory) in order to get to the die() we see. If so: that is strange, and I don't know how it would happen.

Running make clean before make test may help.

Could you update to latest version (clone repo or download as zip) - and give it another shot?

kloczek commented 7 months ago

Running make clean before make test may help.

That would be a bit unusual. If some files should be removed before check this should be part of the all target.

Could you update to latest version (clone repo or download as zip) - and give it another shot?

One sec. Will back shortly.

kloczek commented 7 months ago

Just tested with integrated patches taken from all commits added after 2.0 git tag and I see that DESTDIR style install is not working

+ cd lcov-2.0
+ /usr/bin/make install DESTDIR=/home/tkloczko/rpmbuild/BUILDROOT/lcov-2.0-2.fc35.x86_64 'INSTALL=/usr/bin/install -p' BIN_DIR=/usr/bin CFG_DIR=/etc MAN_DIR=/usr/share/man PREFIX=/usr
Makefile:52: "installing at absolute path '/home/tkloczko/rpmbuild/BUILDROOT/lcov-2.0-2.fc35.x86_64' rather your suggested '/usr'"
/usr/bin/install: cannot change permissions of ‘/usr/bin’: Operation not permitted
kloczek commented 7 months ago

Hmm ..

[tkloczko@pers-jacek lcov-2.0]$ grep -r DESTDIR
rpm/lcov.spec:make install DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr CFG_DIR=/etc
Makefile:DESTDIR := $(shell                           \
Makefile:ifneq ($(PREFIX),$(DESTDIR))
Makefile:$(warning "installing at absolute path '$(DESTDIR)' rather your suggested '$(PREFIX)'")
Makefile:CFG_DIR := $(DESTDIR)/etc
Makefile:BIN_DIR := $(DESTDIR)/bin
Makefile:LIB_DIR := $(DESTDIR)/lib/lcov
Makefile:MAN_DIR := $(DESTDIR)/share/man
Makefile:SHARE_DIR := $(DESTDIR)/share/lcov
Makefile:       rmdir --ignore-fail-on-non-empty $(DESTDIR)/lib || true
Makefile:       rmdir --ignore-fail-on-non-empty $(DESTDIR)/share
Makefile:       rmdir --ignore-fail-on-non-empty $(DESTDIR) || true

Looks like $DESTDIR install root directory is now $PREFIX. But why? 🤔

henry2cox commented 7 months ago

From the README, section 2:

Change to the resulting lcov directory and type:

make install

The default install location is /usr/local. Note that you may need to have superuser permissions to write into system directories.

To install in a different location - for example, your home directory, run:

make PREFIX=$HOME/my_lcov install

your PREFIX should be an absolute path.

henry2cox commented 7 months ago

Running make clean before make test may help.

That would be a bit unusual. If some files should be removed before check this should be part of the all target.

It would be unusual. But, if you ran something beforehand, then perhaps not surprising to need to clean up shrapnel.

kloczek commented 7 months ago

From the README, section 2: [..]

your PREFIX should be an absolute path.

And that is completely non-standard approach. Please restore use DESTDIR semantics.

henry2cox commented 7 months ago

Restarting with the question I should probably have asked to start with:

Other approaches include forking a repo and implementing what you want (possibly submit a pull request), or revert to some older lcov release that you like better.

kloczek commented 7 months ago

If some change has been added always question is: what it fixed? First McGyver rule: If it's not broken, I won't fix it.

henry2cox commented 7 months ago

git log is your friend - or should be.

Think I am done with this one now. Good luck, whatever you decide.

kloczek commented 7 months ago

So again: What kind of issue this change fixed?

henry2cox commented 1 month ago

Closing this issue now. If there is still a problem, please feel free to reopen this issue or file a new one. Please describe the problem in detail and provide a testcase which illustrates the issue, if possible.