Re: keep on patchin'

Craig Small <[email protected]> Mon, 17 Aug 2020 22:52:30 +1000
Newsgroups gmane.linux.procps.devel
Message-ID <CALy8Cw7qWCerwqhtMsyOS44g7bw9U7FGgs0iSzTaixBWvSGuXQ@mail.gmail.com>
Hi Jim,
  I had a look at the test code.

I know everyone doesn't do it; we are always told we always should do it
and.. well we never do it every time and C being the wonderful language it
is ready to bite us.

Checking return values.

I was wondering why I was getting flakey results. As in segfault in random
places in the test script. That means bad pointers/bad memory going on.

There are a lot of

struct thing *ctx;
procps_thing_new(&ctx)
procps_thing_unref(&ctx);

So I first checked that thing_new worked or returned 0 to fail.
Consistent fails, which is better than segfault.
Why did it always fail? Because _new expects a null pointer and fails if
you don't give it one.
unref then does bad thing with whatever the pointer is pointing to.

I also had to disable slabinfo checks because it depends on the permissions
of /proc/slabinfo (0400 here)

 - Craig

 - Craig


On Sun, 16 Aug 2020 at 19:58, Jim Warner <[email protected]> wrote:

> On 8/13/20 6:15 AM, Craig Small wrote:
> > For the check, would there be a way of
> > making a test program and putting it into the lib directory?
>
> Hi Craig,
>
> Attached are 4 patches for the newlib branch related to that new #define
> ITEMTABLE_DEBUG feature.  Since tests are currently found in both the
> lib/ and proc/ directories, this new one went to proc/.
>
> The topmost (#0004) patch is a temporary hack used to activate the
> define and should never be pushed.  However its commit message lists the
> things a 'make check' needs to do to automate the process.
>
> Anyway, I've taken the build stuff as far as I'm able.  Now it's your
> turn to coerce automake into extending his 'make check'.
>
> Incidentally, there is a dejagnu error which I was unable to debug.  It
> appears to relate to that site.exp.  Thus, 'make check' and 'make
> distcheck' each require the '-i' switch if one is to see results from
> this new test.
>
> Regards,
>
> Jim
>
> p.s. If you want to force an error after applying these 4 patches, just
> switch a couple of header file enumerators or source file Item_table
> entries.  I switch the last 2 enumerators in some header so that both
> error messages are produced.
>
>