Changeset 5b993e0


Ignore:
Timestamp:
Mar 25, 2019, 12:05:29 PM (2 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
d3c1c6a
Parents:
d4a60ac
Message:

Updated test scripts to use python3

Location:
tests
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    rd4a60ac r5b993e0  
    2828timeouts=
    2929
    30 TEST_PY = python ${builddir}/test.py
     30TEST_PY = python3 ${builddir}/test.py
    3131
    3232# applies to both programs
  • tests/Makefile.in

    rd4a60ac r5b993e0  
    360360concurrent =
    361361timeouts =
    362 TEST_PY = python ${builddir}/test.py
     362TEST_PY = python3 ${builddir}/test.py
    363363
    364364# applies to both programs
  • tests/config.py.in

    rd4a60ac r5b993e0  
    1 #!/usr/bin/env python
     1#!/usr/bin/env python3
    22# encoding: utf-8
    33"""
  • tests/pybin/settings.py

    rd4a60ac r5b993e0  
    1 from __future__ import print_function
    2 
    31import os
    42import sys
    5 import tools
     3from . import tools
    64
    75try :
  • tests/pybin/tools.py

    rd4a60ac r5b993e0  
    1 from __future__ import print_function
    2 
    31import __main__
    42import argparse
     
    1210import sys
    1311import time
     12import types
    1413
    1514from pybin import settings
     
    5857# Remove 1 or more files silently
    5958def rm( files ):
    60         if isinstance( files, basestring ):
    61                 sh("rm -f %s > /dev/null 2>&1" % files )
    62         else:
    63                 for file in files:
    64                         sh("rm -f %s > /dev/null 2>&1" % file )
     59        if isinstance(files, str ): files = [ files ]
     60        for file in files:
     61                sh("rm -f %s > /dev/null 2>&1" % file )
    6562
    6663# Create 1 or more directory
    6764def mkdir( files ):
    68         if isinstance( files, basestring ):
    69                 sh("mkdir -p %s" % os.path.dirname(files) )
    70         else:
    71                 for file in files:
    72                         sh("mkdir -p %s" % os.path.dirname(file) )
     65        if isinstance(files, str ): files = [ files ]
     66        for file in files:
     67                p = os.path.normpath( file )
     68                d = os.path.dirname ( p )
     69                sh( "mkdir -p {}".format(d) )
    7370
    7471
     
    200197        # Start the walk
    201198        dname = settings.SRCDIR
    202         os.path.walk(dname, step, '')
     199        for dirname, _, names in os.walk(dname):
     200                for name in names:
     201                        path = os.path.join(dirname, name)
     202                        op( path )
    203203
    204204################################################################################
     
    268268                cmd = "%s 2> /dev/null" % column
    269269                proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True)
    270                 proc.communicate(input=text + "\n")
     270                proc.communicate(input=bytes(text + "\n", "UTF-8"))
    271271        else:
    272272                print(text)
  • tests/test.py

    rd4a60ac r5b993e0  
    1 #!/usr/bin/python
    2 from __future__ import print_function
     1#!/usr/bin/python3
    32
    43from pybin.tools import *
     
    102101                print('ERROR: invalid arguments', file=sys.stderr)
    103102                parser.print_help(sys.stderr)
    104                 sys.exit(1)
     103                sys.exit(1)
    105104
    106105        # script must have at least some tests to run or be listing
     
    112111        # check that exactly one of the booleans is set to true
    113112        if not sum( (listing, all_tests, some_tests, some_dirs) ) > 0 :
    114                 print('ERROR: must have option \'--all\', \'--list\', \'--include\', \'-I\' or non-empty test list', file=sys.stderr)
     113                print('''ERROR: must have option '--all', '--list', '--include', '-I' or non-empty test list''', file=sys.stderr)
    115114                parser.print_help()
    116115                sys.exit(1)
     
    281280        elif options.list :
    282281                print("Listing for %s:%s"% (settings.arch.string, settings.debug.string))
    283                 fancy_print("\n".join(map(lambda t: "%s" % (t.toString()), tests)))
     282                fancy_print("\n".join(map(lambda t: t.toString(), tests)))
    284283
    285284        else :
Note: See TracChangeset for help on using the changeset viewer.