<commit_before>#!/usr/bin/env python
import tempfile
import shutil
import sys
import os

class Testing:
    def __init__(self):
        self.failed_tests = set()
        self.succeeded_tests = set()

    def runCTest(self, cfile, msg=''):
        (handle, path) = tempfile.mkstemp()
        temp_dir_path = tempfile.mkdtemp()
        try:
            os.close(handle)
            cmd = "cc %s -Wall --std=c99 -g3 %s -ltraildb -lJudy -o %s" %\
                  (os.getenv('CFLAGS', ''), cfile, path)
            if os.system(cmd) != 0:
                print("FAILED: %s" % cfile)
                self.failed_tests.add(cfile)
                return

            os.system("chmod +x %s" % path)
            result = os.system("%s \"%s\"" % (path, temp_dir_path))
            if result != 0:
                print("FAILED: %s %s" % (cfile, msg))
                self.failed_tests.add(cfile)
            else:
                print("SUCCEEDED: %s %s" % (cfile, msg))
                self.succeeded_tests.add(cfile)
        finally:
            try:
                os.remove(path)
            except:
                pass
            try:
                shutil.rmtree(temp_dir_path)
                os.remove(temp_dir_path + '.tdb')
            except:
                pass

    def runCTests(self, large_tests=False, package_tests=False, **kwargs):
        def walk(node):
            if os.path.isfile(node):
                if node.endswith(".c"):
                    self.runCTest(node)
                    if package_tests:
                        os.environ['TDB_CONS_OUTPUT_FORMAT'] = '1'
                        self.runCTest(node, '(packaged)')<commit_msg>show exit status on failing test<commit_after>#!/usr/bin/env python
import tempfile
import shutil
import sys
import os

class Testing:
    def __init__(self):
        self.failed_tests = set()
        self.succeeded_tests = set()

    def runCTest(self, cfile, msg=''):
        (handle, path) = tempfile.mkstemp()
        temp_dir_path = tempfile.mkdtemp()
        try:
            os.close(handle)
            cmd = "cc %s -Wall --std=c99 -g3 %s -ltraildb -lJudy -o %s" %\
                  (os.getenv('CFLAGS', ''), cfile, path)
            if os.system(cmd) != 0:
                print("FAILED: %s" % cfile)
                self.failed_tests.add(cfile)
                return

            os.system("chmod +x %s" % path)
            result = os.system("%s \"%s\"" % (path, temp_dir_path))
            if result != 0:
                print("FAILED: %s %s with status %s" % (cfile, msg, result))
                self.failed_tests.add(cfile)
            else:
                print("SUCCEEDED: %s %s" % (cfile, msg))
                self.succeeded_tests.add(cfile)
        finally:
            try:
                os.remove(path)
            except:
                pass
            try:
                shutil.rmtree(temp_dir_path)
                os.remove(temp_dir_path + '.tdb')
            except:
                pass

    def runCTests(self, large_tests=False, package_tests=False, **kwargs):
        def walk(node):
            if os.path.isfile(node):
                if node.endswith(".c"):
                    self.runCTest(node)
                    if package_tests:
                        os.environ['TDB_CONS_OUTPUT_FORMAT'] = '1'
                        self.runCTest(node, '(packaged)')
{'fraction_non_alphanumeric': 0.12477718360071301, 'fraction_numerical': 0.0035650623885918, 'mean_word_length': 1.4223021582733812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3704298', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1029, 'n_words': 218}