public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Richard Earnshaw" <Richard.Earnshaw@foss.arm.com>,
	"GCC Development" <gcc@gcc.gnu.org>
Cc: Jakub Jelinek <jakub@redhat.com>,
	tetra2005@gmail.com, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: New mklog script
Date: Fri, 15 May 2020 06:58:51 -0400	[thread overview]
Message-ID: <7e268dce42ae1709781702efedf9f86b1f14c25d.camel@redhat.com> (raw)
In-Reply-To: <92be53d4-51ab-ee7f-53a5-68bdb6ed9a2c@suse.cz>

On Fri, 2020-05-15 at 10:59 +0200, Martin Liška wrote:
> Hi.
> 
> Since we moved to git world and we're in the preparation for
> ChangeLog messages
> being in git commit messages, I think it's the right time to also
> simplify mklog
> script.
> 
> I'm sending a new version (which should eventually replace
> contrib/mklog and contrib/mklog.pl).
> Changes made in the version:
> 
> - the script uses unifdiff - it rapidly simplifies parsing of the '+-
> !' lines that is done
>    in contrib/mklog
> - no author nor date stamp is used - that all can be get from git
> - --inline option is not supported - I don't see a use-case for it
> now
> - the new script has a unit tests (just few of them for now)
> 
> I compares results in between the old Python script for last 80
> commits and it's very close,
> in some cases it does even better.
> 
> I'm planning to maintain and improve the script for the future.
> 
> Thoughts?
> Martin

> +class TestMklog(unittest.TestCase):
> +    def test_macro_definition(self):
> +        changelog = generate_changelog(PATCH1)
> +        assert changelog == EXPECTED1
> +
> +    def test_changed_argument(self):
> +        changelog = generate_changelog(PATCH2)
> +        assert changelog == EXPECTED2
> +
> +    def test_enum_and_struct(self):
> +        changelog = generate_changelog(PATCH3)
> +        assert changelog == EXPECTED3
> +
> +    def test_no_function(self):
> +        changelog = generate_changelog(PATCH3, True)
> +        assert changelog == EXPECTED3B

Use self.assertEqual(a, b) rather than assert a == b, so that if it
fails you get a multiline diff:

e.g.:

import unittest

class TestMklog(unittest.TestCase):
    def test_macro_definition(self):
        self.assertEqual('''
first
second
third''', '''
first
SECOND
third''')

unittest.main()


has this output:

F
======================================================================
FAIL: test_macro_definition (__main__.TestMklog)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/foo.py", line 11, in test_macro_definition
    third''')
AssertionError: '\nfirst\nsecond\nthird' != '\nfirst\nSECOND\nthird'
  
  first
- second
+ SECOND
  third

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (failures=1)

which is much easier to debug than the output from assert a == b, which
is just:

F
======================================================================
FAIL: test_macro_definition (__main__.TestMklog)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/foo.py", line 11, in test_macro_definition
    third''')
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (failures=1)


  reply	other threads:[~2020-05-15 10:58 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 13:29 Automatically generated ChangeLog files - script Martin Liška
2020-04-30 13:45 ` Jakub Jelinek
2020-04-30 15:14   ` Martin Liška
2020-04-30 15:29     ` Jakub Jelinek
2020-05-04 14:44       ` Martin Liška
2020-05-04 18:56   ` Martin Liška
2020-05-04 19:05     ` Jakub Jelinek
2020-05-04 19:22       ` Tobias Burnus
2020-05-04 19:28         ` H.J. Lu
2020-05-06  9:51           ` Mark Eggleston
2020-05-12  9:05 ` Automatically generated ChangeLog files - PHASE 1 Martin Liška
2020-05-12  9:08   ` Martin Liška
2020-05-12  9:12   ` Jakub Jelinek
2020-05-13  8:16   ` Richard Sandiford
2020-05-13  8:56     ` Martin Liška
2020-05-13  9:29       ` Richard Biener
2020-05-13 10:01         ` Martin Liška
2020-05-13  9:26   ` Thomas Koenig
2020-05-13  9:50   ` Jozef Lawrynowicz
2020-05-13 10:01     ` Martin Liška
2020-05-13 10:20   ` Richard Earnshaw
2020-05-13 11:05     ` ChangeLog files - server and client scripts Martin Liška
2020-05-13 12:05       ` ChangeLog files - server and client scripts (git cherry-pick) Martin Liška
2020-05-14 12:42         ` Martin Liška
2020-05-20  7:54           ` Martin Liška
2020-05-20  9:19             ` Thomas Koenig
2020-05-20  9:24               ` Martin Liška
2020-05-20  9:27               ` Jakub Jelinek
2020-05-20 13:59                 ` Richard Earnshaw
2020-05-13 12:35       ` ChangeLog files - server and client scripts Martin Liška
2020-05-13 13:24       ` Richard Earnshaw
2020-05-13 13:33         ` Martin Liška
2020-05-13 17:53       ` Joseph Myers
2020-05-14 12:48         ` Martin Liška
2020-05-14 16:47           ` Joseph Myers
2020-05-15  9:28             ` Martin Liška
2020-05-19  9:26               ` Martin Liška
2020-05-19 22:19                 ` Jonathan Wakely
2020-05-19 22:20                   ` Jonathan Wakely
2020-05-20  8:06                     ` Martin Liška
2020-05-21 15:14                 ` Rainer Orth
2020-05-21 15:19                   ` Martin Liška
2020-05-21 15:37                     ` Rainer Orth
2020-05-21 18:52                       ` Jason Merrill
2020-05-21 18:56                         ` Jakub Jelinek
2020-05-21 18:58                         ` Martin Liška
2020-05-21 19:51                           ` Jason Merrill
2020-05-21 20:27                             ` Martin Liška
2020-05-21 21:01                               ` Jason Merrill
2020-05-21 21:30                                 ` Martin Liška
2020-05-25  8:25                   ` Martin Liška
2020-05-26  5:31                     ` Alexandre Oliva
2020-05-26  6:13                       ` Martin Liška
2020-05-26  7:24                         ` Alexandre Oliva
2020-05-21 22:12                 ` Ian Lance Taylor
2020-05-22  4:57                   ` Jakub Jelinek
2020-05-22  6:05                     ` Martin Liška
2020-05-22 11:04                     ` Richard Earnshaw
2020-05-22 11:11                       ` Jakub Jelinek
2020-05-22 19:37                         ` Ian Lance Taylor
2020-05-22 19:47                           ` Jakub Jelinek
2020-05-22 22:14                             ` Ian Lance Taylor
2020-05-25  7:48                               ` Martin Liška
2020-05-25 20:44                                 ` Ian Lance Taylor
2020-07-08 13:25         ` git-hooks: integrate ChangeLog format check Martin Liška
2020-05-15  8:59     ` New mklog script Martin Liška
2020-05-15 10:58       ` David Malcolm [this message]
2020-05-15 11:20         ` Martin Liška
2020-05-15 13:11           ` David Malcolm
2020-05-15 12:42       ` Marek Polacek
2020-05-15 13:12         ` Martin Liška
2020-05-15 13:22           ` Marek Polacek
2020-05-15 15:38             ` Martin Liška
2020-05-21 22:03               ` Jason Merrill
2020-05-22 21:01                 ` Jason Merrill
2020-05-25  9:23                   ` Martin Liška
2020-05-25 19:41                     ` Jason Merrill
2020-05-26 10:23                       ` Richard Earnshaw
2020-05-26 11:14                         ` Martin Liška
2020-05-26 11:18                           ` Richard Earnshaw
2020-05-26 13:09                             ` Martin Liška
2020-05-26 13:11                               ` Richard Earnshaw
2020-05-26 13:14                                 ` Martin Liška
2020-05-26 13:18                                   ` Jakub Jelinek
2020-05-26 15:38                                   ` Martin Sebor
2020-05-26 18:06                                     ` Jason Merrill
2020-05-27  8:17                                       ` Martin Liška
2020-05-27  8:23                                     ` Martin Liška
2020-05-27 14:11                                       ` git gcc-backport.py : No such file or directory Thomas Koenig
2020-05-27 14:13                                         ` Martin Liška
2020-05-27 14:17                                           ` Martin Liška
2020-05-27 14:41                                             ` Thomas Koenig
2020-05-15 15:06       ` New mklog script Martin Sebor
2020-05-19  8:11         ` Martin Liška
2020-05-19  8:23           ` Jakub Jelinek
2020-05-19  8:55             ` Martin Liška
2020-05-19 14:51               ` Michael Matz
2020-05-19 16:21                 ` Richard Earnshaw
2020-05-19 16:34                   ` Jakub Jelinek
2020-05-19 21:56                     ` Michael Matz
2020-05-19 21:54             ` Jonathan Wakely
2020-05-19  8:53           ` Martin Liška
2020-05-19  9:38             ` Martin Liška
2020-05-19 15:53             ` Joseph Myers
2020-05-19 19:15               ` Martin Liška
2020-05-19 21:50               ` Jonathan Wakely
2020-05-21  8:16         ` Martin Liška
2020-05-22 16:43           ` Martin Sebor
2020-05-22 17:28             ` Thomas Koenig
2020-05-22 18:48               ` Jonathan Wakely
2020-05-25  7:54             ` Martin Liška
2020-05-26 10:15 ` Automatically generated ChangeLog files - script Pierre-Marie de Rodat
2020-05-26 12:27   ` Martin Liška
2020-05-26 12:35     ` Rainer Orth
2020-05-26 13:09       ` Martin Liška
2020-05-26 14:50         ` Pierre-Marie de Rodat
2020-05-26 15:06           ` Martin Liška
2020-06-22 13:15     ` Alexandre Oliva
2020-06-24  8:28       ` Martin Liška
2020-06-29 11:23         ` Martin Liška
2020-07-07  2:14         ` Alexandre Oliva
2020-07-07  7:08           ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e268dce42ae1709781702efedf9f86b1f14c25d.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=mliska@suse.cz \
    --cc=tetra2005@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).