Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14988

Re: How to compile hashlib.c for testing?

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Pierre Gaston <pierre.gaston@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: How to compile hashlib.c for testing?
Date Fri, 28 Dec 2018 09:06:32 +0200
Lines 29
Approved bug-bash@gnu.org
Message-ID <mailman.6449.1545981987.1284.bug-bash@gnu.org> (permalink)
References <CABrM6wm+x0hGuSVYeRLSE9=6vuadxP++4+gSoG+Tm7_yYN4Duw@mail.gmail.com> <31ae9367-7968-aff5-d0e8-0f9da667d584@case.edu> <CABrM6w=a7NyF8xBkooeJojkAK_b=_rz9VsnWt2MWV3HN4BA9Eg@mail.gmail.com> <CAOSMAuuDQDjPandHkOC9Yv41VmmoGme3uRk8P-EJN9_ozPaoQw@mail.gmail.com> <20181228014136.emrgypsauyzdcmgz@crack.deadbeast.net> <CABrM6wmMgwhTkwKTpBqPq15mUY7TCOovEuyoBVGW61dnOLiryw@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1545981987 24323 208.118.235.17 (28 Dec 2018 07:26:27 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Peng Yu <pengyu.ut@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G1U8fq/7FXv39dS1lEAgkzcCMiu+6EjVs4GABA8Ij6E=; b=sL4wABJCiPFqDT1Az3iei3wAis5NIAm+Oy4/RipA9iGiFwr9fJaj+nIsAnGjyy7qQW 6zGv1PI//TkgGcyyaERcf4hbb3cP4rpesyfqQuabx8IBDxwSI9cStt+Dp2QFTp3GD5Sp 5+9gOtiaNWV/Zki+AU6WbU1xGOJXbefDQ8MND2MeuDE6XoMmkIgqRD7wFv82iizqpoim qAR3Ut94aRBXdDAze6gqvOnqb8LQXVw1MPEPyZMRbXvKJgImezEKetFjBcucNpRoZzQK /nDh5vsyHIDBXmDqQL9LhB05djofnN4J9x02ETzu3CVJKd0yp4d1okkzeznpt1knzhGr yEIA==
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=G1U8fq/7FXv39dS1lEAgkzcCMiu+6EjVs4GABA8Ij6E=; b=DUK2NNTLENSHpm2TiccvE3qssPTPisNNd85YUSowLdLdK0OFQRMKZVMiD0WAoM6Ljq 369Gu8oW7qC4TuWs6d0QL9YLe2dih3EIqCxbXo79rWSNq7fHij2cZivsJR5LL0Z2uq83 JEPKOlKP+eR0DH4iho/HJ388Tn5+S+O2tuFyAdxkNwcd8Qg3M9yUWRFVEbOR3kCLTd1D i5ZBM8JMn/iahBBGFLA0P0UWa8ZaxNVT4kluF2hW5WIim5ZSjhjeKR7cj0ObIELi0UcF MY9+YvXW17suE1+OgOpDs3DFIKd2FpAu8TMhrmfrY/zMHPPFm/IMXxaTjbTpxXg+Q1wW H5PA==
X-Gm-Message-State AJcUuke6uHapQaOpmvT23D6jusNnLQQOO5MfrddYxGf0oMnfff0toh8X rtOXEELq2AYsGQwAkVb47lYYvvlBXp5y/ARnalw=
X-Google-Smtp-Source ALg8bN6Wg98Ydo0pZEELmdaER2O67ulJZ5VVJ2Sq6gsrLfe47jWYM73aDTE2/kOZhKp0JJXmZ7QNfo8eMI3buo2tip8=
X-Received by 2002:a0c:ace4:: with SMTP id n33mr25297686qvc.79.1545980803831; Thu, 27 Dec 2018 23:06:43 -0800 (PST)
In-Reply-To <CABrM6wmMgwhTkwKTpBqPq15mUY7TCOovEuyoBVGW61dnOLiryw@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::834
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14988

Show key headers only | View raw


On Fri, Dec 28, 2018 at 4:28 AM Peng Yu <pengyu.ut@gmail.com> wrote:

> We are talking about unit testing in the bash C source code, not bash
> scripts.
>

While toying with the loadable builtins I came up with this:

https://github.com/pgas/newt_builtin/blob/master/make.libbash

you need to set BASH_PATH  so that it points the bash sources
(eg make "BASH_PATH=/path/to/sources" after running ./configure)
and I use it as part my build so it probably needs some work to be truly
usable, but maybe you can adapt it
(or add something like it directly in the Makefile of bash and run make
libbash.a)

I basically compile a .a instead of the bash executable which ensure I
pretty much have everything that's needed.
The problem is that this "library" contains a "main".

So as a workaround I use "-Wl,--wrap=main" when linking and a  "int
__wrap_main(void) ()" instead of main in my test programs.
(basically what is used by cmocka to mock C functions
https://lwn.net/Articles/558106/)

I'm aware that it may raise more questions and difficulties for you than
actually solving anything but it is my 2 cents.
Pierre

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: How to compile hashlib.c for testing? Pierre Gaston <pierre.gaston@gmail.com> - 2018-12-28 09:06 +0200

csiph-web