#!/usr/bin/env python
import testsuite
import os
import yaml

if __name__ == '__main__':
    suite = testsuite.GPSPublicTestsuite(os.path.dirname(__file__))
    suite.testsuite_main()
    # Print the results that are not OK
    all_ok = True
    for k in suite.results:
        status = suite.results[k].name
        if status not in ('PASS', 'XFAIL'):
            all_ok = False
            print "--- {} : {} ---".format(k, status)
            with open(os.path.join(suite.output_dir,
                                   "{}.yaml".format(k)), 'rb') as f:
                y = f.read()
                print yaml.load(y).out

    if all_ok:
        print "SUCCESS"
