From cbe483c32df06d2babbcf99d7ee947c645e7aea3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 30 May 2015 13:28:21 +0100 Subject: Test suite: Use stunt dpkg-parsechangelog This program takes 16ms instead of ~700ms on my computer. This saves 15s out of 100s for the debpolicy-newreject test (in its current state). Currently this is only used by various things in devscripts because dpkg-source uses /usr/lib/dpkg/parsechangelog/debian directly via a Perl module Dpkg::Changelog::Parse. --- tests/tstunt/dpkg-parsechangelog | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 tests/tstunt/dpkg-parsechangelog (limited to 'tests/tstunt') diff --git a/tests/tstunt/dpkg-parsechangelog b/tests/tstunt/dpkg-parsechangelog new file mode 100755 index 0000000..2e0360d --- /dev/null +++ b/tests/tstunt/dpkg-parsechangelog @@ -0,0 +1,53 @@ +#!/usr/bin/perl -w +# +# In an example: +# +# $ time dpkg-parsechangelog >/dev/null +# +# real 0m0.712s +# user 0m0.656s +# sys 0m0.048s +# $ time ~/things/Dgit/dgit/tests/tstunt/dpkg-parsechangelog >/dev/null +# +# real 0m0.016s +# user 0m0.000s +# sys 0m0.012s +# $ + +die if @ARGV; + +use strict; +open C, "debian/changelog" or die $!; + +$!=0; $_ = ; +m/^(\S+) \(([^()]+)\) (\S+)\; urgency=(\S+)$/ or die "$!, $_ ?"; +print <; + if (m/^ -- ([^<>]+\<\S+\>) (\w[^<>]+\w)$/) { + print <