test/genscripts.py
author Volker Birk <vb@pep-project.org>
Mon, 28 Jan 2019 16:50:43 +0100
branchsync
changeset 3249 03119f76ea35
parent 2696 54689953f3bd
permissions -rw-r--r--
...
vb@3249
     1
#! /usr/bin/env python3
vb@3249
     2
krista@2696
     3
# This file is under GNU General Public License 3.0
krista@2696
     4
# see LICENSE.txt
krista@2696
     5
krista@2696
     6
from os import listdir, getcwd
krista@2696
     7
from os.path import isfile, join
krista@2696
     8
from re import sub
krista@2696
     9
import os
krista@2696
    10
import stat
krista@2696
    11
import datetime
krista@2696
    12
krista@2696
    13
srcpath = join(getcwd(), "src/engine_tests")
krista@2696
    14
krista@2696
    15
ls = listdir(srcpath)
krista@2696
    16
krista@2696
    17
for f in ls:
krista@2696
    18
    if isfile(join(srcpath, f)):
krista@2696
    19
        if (f.endswith(".cc")):
krista@2696
    20
            suite = sub('\.cc$', '', f)
krista@2696
    21
            outfile = open(suite, 'w')
krista@2696
    22
            output = (
krista@2696
    23
                "#!/bin/bash\n"
krista@2696
    24
                "# This is a convenience script for launching individual tests and tab completion with TestDriver \n\n" +
krista@2696
    25
                "./TestDriver " + suite + "\n\n")
krista@2696
    26
            outfile.write(output)
krista@2696
    27
            os.chmod(suite, 
krista@2696
    28
                     (stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH | stat.S_IXGRP | stat.S_IXOTH))
vb@3249
    29
            outfile.close()