From owner-freebsd-hackers@freebsd.org Fri Dec 8 17:58:58 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C498E89D29 for ; Fri, 8 Dec 2017 17:58:58 +0000 (UTC) (envelope-from shivanshrai84@gmail.com) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3D537C7AA; Fri, 8 Dec 2017 17:58:57 +0000 (UTC) (envelope-from shivanshrai84@gmail.com) Received: by mail-it0-f43.google.com with SMTP id d137so6470811itc.2; Fri, 08 Dec 2017 09:58:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UzUafJTG+vRqYx98Ua4uGvhauRLWNvaZp/bH3wEN3U0=; b=DWGzPMC1RiMFv1DkS94mkb5aBb6Pfp1L4QrIx5pkNtnxR56JBrF14IzV9ipgCP1f8M FmXmd+7iWiNj2gff5xCvWU8GYa0Ai3B+BDbmt02qMXxgegK3doxtPScRopeHtw0mqRcB Dlr+gq2p4impdRw+fTyWz+L4znx/nn/La59ADCin8Lv4dI/ISXq71CHd5ygPbGeaRFIO 2ePsqEblbfgi/lVMab+yjHeKqG8DTQ+dFu6Ndw3VttwwLr8JketEKWxDe4qRYsmdEyk+ 3J/GllTgzS94q4/gOmjRsZMKHHnjHBskN1TSIccVvC8s1EVNdm28QIymimagrIcl0C8H WyQw== X-Gm-Message-State: AKGB3mLQePabz2Gnk8m8RnAo+/Uo43gb9BJbnUYfnxOKxL9IRC6eyc+K gpEcrZ8M/j0BLQ6kWg+9v7vjCZZd X-Google-Smtp-Source: AGs4zMZUyWieeotVqqbTI5DpX73i2V5w7rIwsGjAPtkyWBUVYjNY4Uh2FYRZN0MNq+dzdIxMUWmk3Q== X-Received: by 10.36.70.195 with SMTP id j186mr6669746itb.32.1512755930671; Fri, 08 Dec 2017 09:58:50 -0800 (PST) Received: from mail-it0-f41.google.com (mail-it0-f41.google.com. [209.85.214.41]) by smtp.gmail.com with ESMTPSA id s4sm995339ita.12.2017.12.08.09.58.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Dec 2017 09:58:49 -0800 (PST) Received: by mail-it0-f41.google.com with SMTP id r6so6456718itr.3; Fri, 08 Dec 2017 09:58:49 -0800 (PST) X-Received: by 10.36.249.132 with SMTP id l126mr7318025ith.52.1512755928856; Fri, 08 Dec 2017 09:58:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Shivansh Rai Date: Fri, 08 Dec 2017 17:58:38 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Different behavior when running `make` To: Alan Somers Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 17:58:58 -0000 Awesome, thanks a lot! I've made the relevant updates and removed dependence on pwd: https://github.com/shivansh/smoketestsuite/compare/f3f68db...b9902cf Will update D12249 too. -- Shivansh On Fri, Dec 8, 2017 at 9:58 PM Alan Somers wrote: > On Fri, Dec 8, 2017 at 8:01 AM, Shivansh Rai 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 >