Skip site navigation (1)Skip section navigation (2)
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
--f403045fb7760dda62055fd6ac80
Content-Type: text/plain; charset="UTF-8"

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

--f403045fb7760dda62055fd6ac80
Content-Type: application/octet-stream; name=Makefile
Content-Disposition: attachment; filename=Makefile
Content-Transfer-Encoding: base64
X-Attachment-Id: f_jay4krr61

IyAkRnJlZUJTRCQKIwojIE1ha2VmaWxlIGZvciBidWlsZGluZyB0aGUgdGVzdCBnZW5lcmF0aW9u
IHRvb2wKClBST0dfQ1hYPQlnZW5lcmF0ZV90ZXN0cwpMT0NBTEJBU0U9CS91c3IvbG9jYWwKTUFO
PQpDWFhGTEFHUys9CS1JJHtMT0NBTEJBU0V9L2luY2x1ZGUgLXN0ZD1jKysxMQpMREZMQUdTKz0J
LUwke0xPQ0FMQkFTRX0vbGliIC1sYm9vc3RfZmlsZXN5c3RlbSAtbGJvb3N0X3N5c3RlbQpTUkNT
PQlsb2dnaW5nLmNwcCBcCgl1dGlscy5jcHAgXAoJcmVhZF9hbm5vdGF0aW9ucy5jcHAgXAoJZ2Vu
ZXJhdGVfbGljZW5zZS5jcHAgXAoJYWR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