[test-suite] r262220 - [cmake] Add support for hashing test binaries
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 2 14:58:26 PST 2016
I thought you need to strip some sections of the binary before you hash? Kristof, why did you strip the binaries previously?
> On Feb 29, 2016, at 5:47 AM, James Molloy via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: jamesm
> Date: Mon Feb 29 07:47:19 2016
> New Revision: 262220
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262220&view=rev
> Log:
> [cmake] Add support for hashing test binaries
>
> This adds the "hash" metric as computed by the HashProgramOutput.sh script (used by the Makefile build).
>
> Added:
> test-suite/trunk/litsupport/hash.py
> Modified:
> test-suite/trunk/litsupport/test.py
>
> Added: test-suite/trunk/litsupport/hash.py
> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/hash.py?rev=262220&view=auto
> ==============================================================================
> --- test-suite/trunk/litsupport/hash.py (added)
> +++ test-suite/trunk/litsupport/hash.py Mon Feb 29 07:47:19 2016
> @@ -0,0 +1,17 @@
> +import lit.Test
> +import hashlib
> +import logging
> +
> +def collect(context, result):
> + try:
> + exename = context.test.getFilePath().rsplit('.test', 1)[0]
> +
> + h = hashlib.md5()
> + h.update(open(exename).read())
> + digest = h.hexdigest()
> +
> + result.addMetric('hash', lit.Test.toMetricValue(digest))
> +
> + except:
> + logging.info('Could not calculate hash for %s' %
> + context.test.getFullName())
>
> Modified: test-suite/trunk/litsupport/test.py
> URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/test.py?rev=262220&r1=262219&r2=262220&view=diff
> ==============================================================================
> --- test-suite/trunk/litsupport/test.py (original)
> +++ test-suite/trunk/litsupport/test.py Mon Feb 29 07:47:19 2016
> @@ -9,6 +9,7 @@ from lit import Test
> from lit.util import to_bytes, to_string
>
> import compiletime
> +import hash
> import perf
> import profilegen
> import runsafely
> @@ -143,5 +144,6 @@ class TestSuiteTest(FileBasedTest):
> for metric, values in metrics.items():
> result.addMetric(metric, lit.Test.toMetricValue(values[0]))
> compiletime.collect(context, result)
> + hash.collect(context, result)
>
> return result
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list