Date: Fri, 8 Dec 2017 09:28:16 -0700 From: Alan Somers <asomers@freebsd.org> To: Shivansh Rai <shivansh@freebsd.org> Cc: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: Different behavior when running `make` Message-ID: <CAOtMX2jSbhvqf6uwb6as88VsZpLagC3nXpvUDTYvZJO3g%2BHgyA@mail.gmail.com> In-Reply-To: <CAF%2Bp1Htw%2Baf4dfy8oFgXUPx1v7s1y84-Hv7rz4P9Yh%2BwOToNyQ@mail.gmail.com> References: <CAF%2Bp1Htw%2Baf4dfy8oFgXUPx1v7s1y84-Hv7rz4P9Yh%2BwOToNyQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Fri, Dec 8, 2017 at 8:01 AM, Shivansh Rai <shivansh@freebsd.org> wrote: > Hello all, > > I'm currently working on a tool for automating generation of smoketests for > all the utilities in the base system [1]. Until now I was testing things on > a very old branch from around August (git sha 92d8705), and after updating > my branch (git sha 7ea30ed) I'm starting to notice a different behavior. > > The tool is located at `~/freebsd/tools/tools/smoketestsuite` [2] in my > system. > Executing `make` inside [2] produces the following output - > ``` > [Creating objdir > /usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/ > tools/smoketestsuite...] > c++ -I/usr/local/include -std=c++11 -c logging.cpp > c++: error: no such file or directory: 'logging.cpp' > c++: error: no input files > *** Error code 1 > ``` > > The interesting thing to be noted is the first line of the above trace > where a new directory under `/usr/obj` is created (I've noticed this for > the first time, after I updated my branch). > > The location > `/usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/tools/smoketestsuite` > [3] is empty, and it seems that `make` tries to look up `logging.cpp` (and > all other files) in [3] instead of [2]. This is evident from the fact that > if I manually populate [3] will all the relevant files, everything works > fine. > Also, all the side-effects which `make` introduces (new files, new binaries > etc.) are populated at [3] instead of [2]. > > If the tool is kept at a location outside the src tree (not under > `~/freebsd`), everything works fine (and the temporary directory under > `/usr/obj` is not created for those locations when `make` is executed). So > the problem seems to be in the way `make` is running inside the src tree. > > I've attached the system call trace for the failing execution. > It'd be extremely helpful if someone could please shed light on what seems > to be the problem here, and what should be the right workflow. > > [1]: For some more reference, the tool is currently available at ` > https://github.com/shivansh/smoketestsuite/' (svn branch) (D12249). > [2]: `~/freebsd/tools/tools/smoketestsuite` > [3]: > `/usr/obj/usr/home/zeebsd/freebsd/amd64.amd64/tools/tools/smoketestsuite` > > Thanks in advance! > With best regards, > Shivansh Rai > make is failing because it's implicitly cd'ing to ${MAKEOBJDIRPREFIX}/${.CURDIR} before running any commands. I don't know if that's at all contingent on the build being started from within a FreeBSD source tree, but the easiest solution is to work with the build system rather than against it. I've attached a working version. The scripts don't all work, however. They still contain assumptions about pwd, for example at scripts/fetch_utils.sh:32. -Alan [-- Attachment #2 --] # $FreeBSD$ # # Makefile for building the test generation tool PROG_CXX= generate_tests LOCALBASE= /usr/local MAN= CXXFLAGS+= -I${LOCALBASE}/include -std=c++11 LDFLAGS+= -L${LOCALBASE}/lib -lboost_filesystem -lboost_system SRCS= logging.cpp \ utils.cpp \ read_annotations.cpp \ generate_license.cpp \ add_testcase.cpp \ fetch_groff.cpp \ generate_test.cpp .PHONY: clean \ fetch_groff \ fetch_utils \ run fetch_groff: sh ${.CURDIR}/scripts/fetch_groff.sh fetch_utils: sh ${.CURDIR}/scripts/fetch_utils.sh run: @echo Generating annotations... sh ${.CURDIR}/scripts/generate_annot.sh @echo Generating test files... ./generate_tests .include <bsd.prog.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2jSbhvqf6uwb6as88VsZpLagC3nXpvUDTYvZJO3g%2BHgyA>
