framework/log: Avoid carriage-return when stdout is not a TTY.

Otherwise Jenkins won't show any progress while piglit is running.

(Another alternative would be to detect the presence of
JENKINS_HOME/HUDSON_HOME environment variables.)
summary/junit: Fix group splitting on Windows.

Because test paths end up having a mixture of backward and forward
slashes.

Trivial.
summary/html: Fix processing of Windows results.

- Prevent the use of reserved characters in filenames (e.g., '>' and '<'
  which are used in several cases.)

- Handle mixture of backward and forward slashes gracefuly.

v2: Apply Ilia Mirkin and Dylan Baker's suggestions.
util/framework/glut: Report skip when GLUT is unable to create the requested context.

Trivial. It won't affect platforms which use waffle.
framework: Split code out of framework.core

This splits results code out of core into its own module. This makes the
code cleaner and easier to understand, and is groundwork for coming
patches.
results.py: Replace JSONEncoder subclass with default method

Both methods are equally viable solution when using the builtin json
module, but using defaults is superior when using simplejson (a C based
implementation of the json module providing an identical interface but
vastly better performance) which can be used with piglit if it's
installed.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
results.py: Modernize some things

Use super() instead of an explicit call to the parent class in one case,
and make all classes descend from object (make them new-style classes)

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
results.py: Cleanup pylint warnings

These are mostly from one of two sources:
1. overriding builtin names
2. pep8 compliance issues

A couple of the other errors:
- an unused keyword argument
- extra grouping parens

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
results.py: Simplify TestrunResult.write()

This simplifies TestrunResult.write() to use a generator expression.
This method isn't currently used, but it will be useful in a patch later
in this series.

This also adds a testcase for this function to ensure that what it
writes is equivalent to what it reads.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
framework: consolidate boilerplate in JSNOWriter class

This moves all of the code for writing the name, the options, etc out of
run and resume and into a single method of JSONWriter. This should
reduce errors, code duplication, and help abstract a lot of problems
with future changes to the json away.

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
framework: Update results to use versioned numbers

This patch updates our json to version 1. Changes from version 0 to
version 1 are as follows:

- renamed 'main' to 'results.json'
- dmesg must be a string (It was stored a list in some version 0
  results)
- subtests are never stored as duplicate entries, a single instance of
  the test is recorded, (In version 0 both are possible)
- there is no info entry in version 1, err, out, and returncode are
  always split into seperate entries

This patch adds support to the results module for handling updates to
the results in a sane way. It does this by adding a result_version
attribute to the TestrunResult (which is stored as json), and
implementing the ability to incrementally update results between
versions.

It does this automatically on load, non-destructively, moving the old
results to results.json.old, but does write the updated results to disk,
making the cost of this update a one time cost.

v2: - Handle non-writable directories and files, this also fixes using
      file-descriptors as inputs

Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
summary.py: Remove work-arounds for version 0 result bugs

These work-arounds are no longer necissary since they are handled by the
result format updater on load.