ID: | 4196 |
From: | ge...@igor2.repo.hu |
Date: | Tue, 16 Jun 2020 10:37:53 +0200 (CEST) |
Subject: | [pcb-rnd] new: util for diffing pcbs |
Hi all, as of r31946, we have a new utility called pcb-rnd-svg, which can compare board files both using graphical/visual and text approach, for manual inspection and automated testing. The new script is in trunk/util/ and it has a --help and a manual page in trunk/doc/man. I hope you will find the script useful. Below is how the script works. 1. GUI comparison You can run it on two board files to get an svg that you can then open in an image viewer or your favorite web browser, as shown in this mini-howto: http://repo.hu/cgi-bin/pool.cgi?cmd=show&node=visual_diff I know there was always many similar tools out there, doing this on png, gerber and whatnot. The reason I wrote this is that I needed a more reliable way, that worked the same way both in automated/text/cli environment (for automated testing of alien file format code) and in GUI (for being able to see what really went wrong when a test failed). The trick this method does and other scripts usually didn't do are described below, in point 3. 2. CLI and automated testing The script can generate a diff of svgs in diff -u format. This is useful for non-gui comparison. There are also commands implemented for batch-testing a collection of files against saved reference svg files. This is what we can use for automated testing. The first area where this is going to happen will be alien file formats, starting with io_eagle (that I am heavily fixing up these days). 3. Why is this script better than many of the previous attempts? The question is always "why did we have to have new code for this?". The answer is in the requirements I had for the alien fiel format tests: - a tool that can do a diff without using anything "non-standard" (such as imagemagick) - a tool that can do the _same_ diff in text and visual/graphical format - the visual variant needs to have a property that I can easily remove parts of the diff manually; this is very important in untangling complicated diffs Existing solutions didn't seem to offer all the above, so I wrote a new script. The tricks the new script employs: - We use the svg output of pcb-rnd. The reason is that this format is basically text, with one line representing one _graphical object_ - no complex metadata like padstacks or subcircuits or nets - We would still have the problem of order-of-objects: different compilations/versions of pcb-rnd may end up saving the svg file with the same objects packed in a slightly different order. That'd be noise in the output. So the script, using the "one object is one line" property of our svg export, sorts objects within each group. - The visual output is an svg that uses the faded verison of the first input file, with a new group on top of everything else for the differing objects, colored by which input file the object was in. This setup, unlike a png, makes it very easy to manipulate what's visible, using a plain text editor (or awk). Best regards, Igor2
Reply subtree:
4196 [pcb-rnd] new: util for diffing pcbs from ge...@igor2.repo.hu