From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 2/2] testsuite: add a script to normalize label names
Date: Mon, 21 Nov 2016 05:14:21 +0100 [thread overview]
Message-ID: <20161121041421.34576-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20161121041421.34576-1-luc.vanoostenryck@gmail.com>
test-linearize displays basic block's labels by using
'.L0x' + plus the address of the bb struct. This is certainly
convenient as an UID but it has the disadvantage that these
labels names are not comparable between runs.
This complicate testing quite a bit.
This script more or less solve this by filtering the output of
test-linearize and change these names to some nice sequential
and comparable '.L1', '.L2', ...
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
validation/normalize-bb | 16 ++++++++++++++++
validation/test-normalize-bb.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100755 validation/normalize-bb
create mode 100644 validation/test-normalize-bb.c
diff --git a/validation/normalize-bb b/validation/normalize-bb
new file mode 100755
index 00000000..a7c7b73b
--- /dev/null
+++ b/validation/normalize-bb
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+out=$(mktemp)
+sed=$(mktemp)
+
+n=0
+tee $out | grep '^\.L0x' | sort -u | \
+ sed 's/\(.L0x[0-9a-f]*\).*/\1/' | \
+ while read l; do
+ n=$(($n + 1))
+ echo "s/$l/.L$n/"
+ done > $sed
+
+cat $out | sed -f $sed
+
+rm -f $out $sed
diff --git a/validation/test-normalize-bb.c b/validation/test-normalize-bb.c
new file mode 100644
index 00000000..57a5886e
--- /dev/null
+++ b/validation/test-normalize-bb.c
@@ -0,0 +1,31 @@
+/*
+ * test the normalization of basic block's names
+ */
+
+void use(int);
+void foo(int p);
+void foo(int p)
+{
+ if (p)
+ use(1);
+}
+
+/*
+ * check-name: test-normalize-bb
+ * check-command: test-linearize $file | ./normalize-bb
+ * check-output-start
+foo:
+.L1:
+ <entry-point>
+ br %arg1, .L2, .L3
+
+.L2:
+ call use, $1
+ br .L3
+
+.L3:
+ ret
+
+
+ * check-output-end
+ */
--
2.10.2
next prev parent reply other threads:[~2016-11-21 4:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 4:14 [PATCH 0/2] normalize bb's label names for testing Luc Van Oostenryck
2016-11-21 4:14 ` [PATCH 1/2] testsuite: allow commands to use pipes Luc Van Oostenryck
2016-11-21 4:14 ` Luc Van Oostenryck [this message]
2016-11-22 10:02 ` [PATCH 0/2] normalize bb's label names for testing Christopher Li
2016-11-22 13:27 ` Luc Van Oostenryck
2016-11-22 16:44 ` Christopher Li
2016-11-22 17:02 ` Luc Van Oostenryck
2016-11-22 15:42 ` [PATCH] give comparable label's names to basic blocks Luc Van Oostenryck
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=20161121041421.34576-3-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.org \
/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 NNTP newsgroup(s).