Changeset a43e1d7


Ignore:
Timestamp:
Jul 5, 2016, 11:10:03 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
39f04ec
Parents:
76c7f65
Message:

test script should now support make target that do not produce executables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/test.py

    r76c7f65 ra43e1d7  
    99import os
    1010import re
     11import stat
    1112import sys
    1213
     
    6061                return result;
    6162
     63def fileIsExecutable(file) :
     64        try :
     65                fileinfo = os.stat(file)
     66                return bool(fileinfo.st_mode & stat.S_IXUSR)
     67        except Exception as inst:
     68                print(type(inst))    # the exception instance
     69                print(inst.args)     # arguments stored in .args
     70                print(inst)
     71                return False
    6272
    6373################################################################################
     
    7888                stdinput = "< .in/%s.txt" % test if isfile(".in/%s.txt" % test) else ""
    7989
    80                 # run test
    81                 sh("./%s %s > %s 2>&1" % (test, stdinput, out_file), dry_run)
     90                if fileIsExecutable(test) :
     91                        # run test
     92                        sh("./%s %s > %s 2>&1" % (test, stdinput, out_file), dry_run)
     93                else :
     94                        # simply cat the result into the output
     95                        sh("cat %s > %s" % (test, out_file), dry_run)
    8296
    8397        retcode = 0
Note: See TracChangeset for help on using the changeset viewer.