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
|
# drive APMrover2 in SITL
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import shutil
|
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')
|
valgrind_log = util.valgrind_log_filepath(binary=binary, model='rover')
|
||||||
if os.path.exists(valgrind_log):
|
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"))
|
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/APMrover2-valgrind.log"))
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# switch 4 = Auto
|
# switch 4 = Auto
|
||||||
# switch 5 = Loiter
|
# switch 5 = Loiter
|
||||||
# switch 6 = Stabilize
|
# switch 6 = Stabilize
|
||||||
|
from __future__ import print_function
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import shutil
|
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='+')
|
valgrind_log = util.valgrind_log_filepath(binary=binary, model='+')
|
||||||
if os.path.exists(valgrind_log):
|
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"))
|
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
|
# [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')
|
valgrind_log = util.valgrind_log_filepath(binary=binary, model='heli')
|
||||||
if os.path.exists(valgrind_log):
|
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"))
|
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/Helicopter-valgrind.log"))
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Fly ArduPlane in SITL
|
# Fly ArduPlane in SITL
|
||||||
|
from __future__ import print_function
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import shutil
|
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')
|
valgrind_log = util.valgrind_log_filepath(binary=binary, model='plane-elevrev')
|
||||||
if os.path.exists(valgrind_log):
|
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"))
|
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/ArduPlane-valgrind.log"))
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
APM automatic test suite
|
APM automatic test suite
|
||||||
Andrew Tridgell, October 2011
|
Andrew Tridgell, October 2011
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
import atexit
|
import atexit
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import glob
|
import glob
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import print_function
|
||||||
import math
|
import math
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
dump flash logs from SITL
|
dump flash logs from SITL
|
||||||
Andrew Tridgell, April 2013
|
Andrew Tridgell, April 2013
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from __future__ import print_function
|
||||||
import errno
|
import errno
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
Run a jsbsim model as a child process.
|
Run a jsbsim model as a child process.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
import atexit
|
import atexit
|
||||||
import errno
|
import errno
|
||||||
import fdpexpect
|
import fdpexpect
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from __future__ import print_function
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
from param import known_param_fields
|
from param import known_param_fields
|
||||||
from emit import Emit
|
from emit import Emit
|
||||||
@ -254,7 +254,7 @@ def table_test():
|
|||||||
print(e.tablify([["A", "B"], ["C", "D"]]))
|
print(e.tablify([["A", "B"], ["C", "D"]]))
|
||||||
|
|
||||||
print("Test 2")
|
print("Test 2")
|
||||||
print e.tablify([["A", "B"], ["CD\nE", "FG"]])
|
print(e.tablify([["A", "B"], ["CD\nE", "FG"]]))
|
||||||
|
|
||||||
print("Test 3")
|
print("Test 3")
|
||||||
print(e.tablify([["A", "B"], ["CD\nEF", "GH"]], rowheadings=["r1", "row2"]))
|
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 $
|
$Id: fdpexpect.py 505 2007-12-26 21:33:50Z noah $
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pexpect import ExceptionPexpect, spawn
|
from pexpect import ExceptionPexpect, spawn
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
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
|
from math import acos, asin, atan2, cos, pi, radians, sin, sqrt
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""
|
"""
|
||||||
simple test of wind generation code
|
simple test of wind generation code
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
import time
|
import time
|
||||||
import util
|
import util
|
||||||
from rotmat import Vector3
|
from rotmat import Vector3
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import print_function
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
@ -9,8 +10,12 @@ from subprocess import PIPE, Popen, call, check_call
|
|||||||
|
|
||||||
import pexpect
|
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):
|
def m2ft(x):
|
||||||
"""Meters to feet."""
|
"""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))
|
print("Running: %s" % cmd_as_shell(cmd))
|
||||||
first = cmd[0]
|
first = cmd[0]
|
||||||
rest = cmd[1:]
|
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
|
delaybeforesend = 0
|
||||||
pexpect_autoclose(child)
|
pexpect_autoclose(child)
|
||||||
# give time for parameters to properly setup
|
# 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
|
# TODO: have a SITL-compiled ardupilot able to have its
|
||||||
# console on an output fd.
|
# console on an output fd.
|
||||||
else:
|
else:
|
||||||
child.expect(u'Waiting for connection', timeout=300)
|
child.expect('Waiting for connection', timeout=300)
|
||||||
return child
|
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
|
cmd += ' --aircraft=%s' % aircraft
|
||||||
if options is not None:
|
if options is not None:
|
||||||
cmd += ' ' + options
|
cmd += ' ' + options
|
||||||
ret = pexpect.spawn(cmd, logfile=logfile, timeout=60)
|
ret = pexpect.spawn(cmd, logfile=logfile, encoding=ENCODING, timeout=60)
|
||||||
ret.delaybeforesend = 0
|
ret.delaybeforesend = 0
|
||||||
pexpect_autoclose(ret)
|
pexpect_autoclose(ret)
|
||||||
return ret
|
return ret
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# fly ArduPlane QuadPlane in SITL
|
# fly ArduPlane QuadPlane in SITL
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import pexpect
|
import pexpect
|
||||||
import shutil
|
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')
|
valgrind_log = util.valgrind_log_filepath(binary=binary, model='quadplane')
|
||||||
if os.path.exists(valgrind_log):
|
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"))
|
shutil.copy(valgrind_log, util.reltopdir("../buildlogs/QuadPlane-valgrind.log"))
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
|
Loading…
Reference in New Issue
Block a user