diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-01-29 00:17:08 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-01-29 04:19:04 +0100 |
commit | 762260235403efd5dade67219a6a38c05d335f39 (patch) | |
tree | 457288029807a8b883c5dd8d41fcc11febf09b9c /tests | |
parent | c30a98bf6e6140a837a72a94b70bdfc01ea700f9 (diff) |
Fix parser valgrind suppressions script
Change-Id: I8ef6e4f87f3f95532c7165e746c22447a17293ab
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--[-rwxr-xr-x] | tests/parse_valgrind_suppressions.sh | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/tests/parse_valgrind_suppressions.sh b/tests/parse_valgrind_suppressions.sh index 681b8211..cf140158 100755..100644 --- a/tests/parse_valgrind_suppressions.sh +++ b/tests/parse_valgrind_suppressions.sh @@ -11,47 +11,51 @@ # The checksum is used as an index in a different array. If an item with that index already exists the suppression must be a duplicate and is discarded. BEGIN { suppression=0; md5sum = "md5sum" } - # If the line begins with '{', it's the start of a supression; so set the var and initialise things - /^{/ { - suppression=1; i=0; next - } - # If the line begins with '}' its the end of a suppression - /^}/ { - if (suppression) - { suppression=0; - close(md5sum, "to") # We've finished sending data to md5sum, so close that part of the pipe - ProcessInput() # Do the slightly-complicated stuff in functions - delete supparray # We don't want subsequent suppressions to append to it! - } - } - # Otherwise, it's a normal line. If we're inside a supression, store it, and pipe it to md5sum. Otherwise it's cruft, so ignore it - { if (suppression) - { - supparray[++i] = $0 - print |& md5sum - } - } +# If the line begins with ' {', it's the start of a supression; +so set the var and initialize things +/^{/ { + suppression=1; + i=0; + next + } +# If the line begins with '}' its the end of a suppression + /^ +}/ { + if (suppression) + { suppression=0; + close(md5sum, "to") # We've finished sending data to md5sum, so close that part of the pipe + ProcessInput() # Do the slightly-complicated stuff in functions + delete supparray # We don't want subsequent suppressions to append to it! + } +} +# Otherwise, it's a normal line. If we're inside a supression, store it, and pipe it to md5sum. Otherwise it's cruft, so ignore it +{ if (suppression) + { + supparray[++i] = $0 + print |& md5sum + } +} - - function ProcessInput() - { - # Pipe the result from md5sum, then close it +function ProcessInput() +{ +# Pipe the result from md5sum, then close it md5sum |& getline result close(md5sum) - # gawk can't cope with enormous ints like $result would be, so stringify it first by prefixing a definite string +# gawk can't cope with enormous ints like $result would be, so stringify it first by prefixing a definite string resultstring = "prefix"result if (! (resultstring in chksum_array) ) - { chksum_array[resultstring] = 0; # This checksum hasn't been seen before, so add it to the array + { chksum_array[resultstring] = 0; +# This checksum hasn't been seen before, so add it to the array OutputSuppression() # and output the contents of the suppression - } - } + } +} - function OutputSuppression() - { - # A suppression is surrounded by '{' and '}'. Its data was stored line by line in the array - print "{" - for (n=1; n <= i; ++n) +function OutputSuppression() +{ +# A suppression is surrounded by ' {' and '}'. Its data was stored line by line in the array + print "{" + for (n=1; n <= i; ++n) { print supparray[n] } - print "}" - } + print "}" +} |