Re: Better testing coverage and unified coding for plpgsql loops

From: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Better testing coverage and unified coding for plpgsql loops
Date: 2018-01-02 12:54:24
Message-ID: CAC8Q8t+nY_O+-KAvHao2T9Fj7rw1hVeSNNALERHyhvpTMgafgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

> However, while I was doing that, it seemed like the tests I was adding
> were mighty repetitive, as many of them were just exactly the same thing
> adjusted for a different kind of loop statement. And so I began to wonder
> why it was that we had five copies of the RC_FOO management logic, no two
> quite alike. If we only had *one* copy then it would not seem necessary
> to have such duplicative test cases for it. A bit of hacking later, and
> I had the management logic expressed as a macro, with only one copy for
> all five kinds of loop. I verified it still passes the previous set of
> tests and then removed the ones that seemed redundant, yielding
> plpgsql-unify-loop-rc-code.patch below. So what I propose actually
> committing is the combination of these two patches.
>

I have looked into plpgsql-unify-loop-rc-code.patch.
I have two questions:

- how do currently existing coverage tools display coverage for such a
large macro?

I expect DEFINE's to be treated as comments.

I've looked into https://coverage.postgresql.org/src/port/qsort.c.gcov.html and
on line 70 I see a similar multi line define that is yellow in coverage,
not counted at all. I think that "higher coverage" effect you are seeing is
mostly due to code being hidden from coverage counter, not actually better
testing. Another thing I see is that most define's are in .h files, and
they're also not in coverage report mostly.

- can this macro become a function?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim Gündüz 2018-01-02 13:43:35 Re: How to Works with Centos
Previous Message Pavan Deolasee 2018-01-02 12:51:51 Re: Faster inserts with mostly-monotonically increasing values