mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
autotest: python3 support
This commit is contained in:
parent
5786d66ea1
commit
bec09b9a57
@ -1,5 +1,5 @@
|
||||
# drive APMrover2 in SITL
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import shutil
|
||||
|
||||
@ -188,7 +188,7 @@ def drive_APMrover2(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fa
|
||||
|
||||
valgrind_log = util.valgrind_log_filepath(binary=binary, model='rover')
|
||||
if os.path.exists(valgrind_log):
|
||||
os.chmod(valgrind_log, 0644)
|
||||
os.chmod(valgrind_log, 0o644)
|
||||
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/APMrover2-valgrind.log"))
|
||||
|
||||
if failed:
|
||||
|
@ -6,7 +6,7 @@
|
||||
# switch 4 = Auto
|
||||
# switch 5 = Loiter
|
||||
# switch 6 = Stabilize
|
||||
|
||||
from __future__ import print_function
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
@ -1291,7 +1291,7 @@ def fly_ArduCopter(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fal
|
||||
|
||||
valgrind_log = util.valgrind_log_filepath(binary=binary, model='+')
|
||||
if os.path.exists(valgrind_log):
|
||||
os.chmod(valgrind_log, 0644)
|
||||
os.chmod(valgrind_log, 0o644)
|
||||
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/ArduCopter-valgrind.log"))
|
||||
|
||||
# [2014/05/07] FC Because I'm doing a cross machine build (source is on host, build is on guest VM) I cannot hard link
|
||||
@ -1418,7 +1418,7 @@ def fly_CopterAVC(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fals
|
||||
|
||||
valgrind_log = util.valgrind_log_filepath(binary=binary, model='heli')
|
||||
if os.path.exists(valgrind_log):
|
||||
os.chmod(valgrind_log, 0644)
|
||||
os.chmod(valgrind_log, 0o644)
|
||||
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/Helicopter-valgrind.log"))
|
||||
|
||||
if failed:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Fly ArduPlane in SITL
|
||||
|
||||
from __future__ import print_function
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
@ -565,7 +565,7 @@ def fly_ArduPlane(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fals
|
||||
|
||||
valgrind_log = util.valgrind_log_filepath(binary=binary, model='plane-elevrev')
|
||||
if os.path.exists(valgrind_log):
|
||||
os.chmod(valgrind_log, 0644)
|
||||
os.chmod(valgrind_log, 0o644)
|
||||
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/ArduPlane-valgrind.log"))
|
||||
|
||||
if failed:
|
||||
|
@ -3,7 +3,7 @@
|
||||
APM automatic test suite
|
||||
Andrew Tridgell, October 2011
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import atexit
|
||||
import fnmatch
|
||||
import glob
|
||||
|
@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
import math
|
||||
import time
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
dump flash logs from SITL
|
||||
Andrew Tridgell, April 2013
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import errno
|
||||
import socket
|
||||
import struct
|
||||
|
@ -2,7 +2,7 @@
|
||||
"""
|
||||
Run a jsbsim model as a child process.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import atexit
|
||||
import errno
|
||||
import fdpexpect
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
from param import known_param_fields
|
||||
from emit import Emit
|
||||
@ -254,7 +254,7 @@ def table_test():
|
||||
print(e.tablify([["A", "B"], ["C", "D"]]))
|
||||
|
||||
print("Test 2")
|
||||
print e.tablify([["A", "B"], ["CD\nE", "FG"]])
|
||||
print(e.tablify([["A", "B"], ["CD\nE", "FG"]]))
|
||||
|
||||
print("Test 3")
|
||||
print(e.tablify([["A", "B"], ["CD\nEF", "GH"]], rowheadings=["r1", "row2"]))
|
||||
|
@ -3,7 +3,7 @@ So you are responsible for opening and close the file descriptor.
|
||||
|
||||
$Id: fdpexpect.py 505 2007-12-26 21:33:50Z noah $
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
|
||||
from pexpect import ExceptionPexpect, spawn
|
||||
|
@ -21,7 +21,7 @@
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
from math import acos, asin, atan2, cos, pi, radians, sin, sqrt
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"""
|
||||
simple test of wind generation code
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import time
|
||||
import util
|
||||
from rotmat import Vector3
|
||||
|
@ -1,3 +1,4 @@
|
||||
from __future__ import print_function
|
||||
import math
|
||||
import os
|
||||
import random
|
||||
@ -9,8 +10,12 @@ from subprocess import PIPE, Popen, call, check_call
|
||||
|
||||
import pexpect
|
||||
|
||||
from rotmat import Matrix3, Vector3
|
||||
from . rotmat import Matrix3, Vector3
|
||||
|
||||
if (sys.version_info[0] >= 3):
|
||||
ENCODING = 'ascii'
|
||||
else:
|
||||
ENCODING = None
|
||||
|
||||
def m2ft(x):
|
||||
"""Meters to feet."""
|
||||
@ -211,7 +216,7 @@ def start_SITL(binary, valgrind=False, gdb=False, wipe=False, synthetic_clock=Tr
|
||||
print("Running: %s" % cmd_as_shell(cmd))
|
||||
first = cmd[0]
|
||||
rest = cmd[1:]
|
||||
child = pexpect.spawn(first, rest, logfile=sys.stdout, timeout=5)
|
||||
child = pexpect.spawn(first, rest, logfile=sys.stdout, encoding=ENCODING, timeout=5)
|
||||
delaybeforesend = 0
|
||||
pexpect_autoclose(child)
|
||||
# give time for parameters to properly setup
|
||||
@ -224,7 +229,7 @@ def start_SITL(binary, valgrind=False, gdb=False, wipe=False, synthetic_clock=Tr
|
||||
# TODO: have a SITL-compiled ardupilot able to have its
|
||||
# console on an output fd.
|
||||
else:
|
||||
child.expect(u'Waiting for connection', timeout=300)
|
||||
child.expect('Waiting for connection', timeout=300)
|
||||
return child
|
||||
|
||||
|
||||
@ -242,7 +247,7 @@ def start_MAVProxy_SITL(atype, aircraft=None, setup=False, master='tcp:127.0.0.1
|
||||
cmd += ' --aircraft=%s' % aircraft
|
||||
if options is not None:
|
||||
cmd += ' ' + options
|
||||
ret = pexpect.spawn(cmd, logfile=logfile, timeout=60)
|
||||
ret = pexpect.spawn(cmd, logfile=logfile, encoding=ENCODING, timeout=60)
|
||||
ret.delaybeforesend = 0
|
||||
pexpect_autoclose(ret)
|
||||
return ret
|
||||
|
@ -1,5 +1,5 @@
|
||||
# fly ArduPlane QuadPlane in SITL
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import pexpect
|
||||
import shutil
|
||||
@ -126,7 +126,7 @@ def fly_QuadPlane(binary, viewerip=None, use_map=False, valgrind=False, gdb=Fals
|
||||
|
||||
valgrind_log = util.valgrind_log_filepath(binary=binary, model='quadplane')
|
||||
if os.path.exists(valgrind_log):
|
||||
os.chmod(valgrind_log, 0644)
|
||||
os.chmod(valgrind_log, 0o644)
|
||||
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/QuadPlane-valgrind.log"))
|
||||
|
||||
if failed:
|
||||
|
Loading…
Reference in New Issue
Block a user