From 623e49671938beafe87ee90b79b1a91bf6374e40 Mon Sep 17 00:00:00 2001 From: Samuel Sadok Date: Thu, 4 Jun 2020 13:05:02 +0200 Subject: [PATCH] fix various test suite issues --- tools/odrive/tests/analog_input_test.py | 2 +- tools/odrive/tests/can_test.py | 1 + tools/odrive/tests/encoder_test.py | 2 +- tools/odrive/tests/test_runner.py | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/odrive/tests/analog_input_test.py b/tools/odrive/tests/analog_input_test.py index 2110d6f5..d1b435b3 100644 --- a/tools/odrive/tests/analog_input_test.py +++ b/tools/odrive/tests/analog_input_test.py @@ -103,7 +103,7 @@ class TestAnalogInput(): # Expect mean error to be at most 2% (of the full scale). # Expect there to be less than 2% outliers, where an outlier is anything that is more than 5% (of full scale) away from the expected value. full_range = abs(max_val - min_val) - slope, offset, fitted_curve = fit_sawtooth(data, min_val, max_val) + slope, offset, fitted_curve = fit_sawtooth(data, min_val, max_val, sigma=30) test_assert_eq(slope, (max_val - min_val) / period, accuracy=0.005) test_curve_fit(data, fitted_curve, max_mean_err = full_range * 0.02, inlier_range = full_range * 0.05, max_outliers = len(data[:,0]) * 0.02) diff --git a/tools/odrive/tests/can_test.py b/tools/odrive/tests/can_test.py index e3535f54..ccbaf365 100644 --- a/tools/odrive/tests/can_test.py +++ b/tools/odrive/tests/can_test.py @@ -112,6 +112,7 @@ class TestSimpleCAN(): odrive.unuse_gpios() axis = odrive.handle.axis0 + axis.config.enable_watchdog = False axis.clear_errors() axis.config.can_node_id = node_id axis.config.can_node_id_extended = extended_id diff --git a/tools/odrive/tests/encoder_test.py b/tools/odrive/tests/encoder_test.py index 59eac451..af7f624c 100644 --- a/tools/odrive/tests/encoder_test.py +++ b/tools/odrive/tests/encoder_test.py @@ -69,7 +69,7 @@ class TestEncoderBase(): slope, offset, fitted_curve = fit_line(data[:,(0,6)]) test_assert_eq(slope, 0.0, range = true_cpr * abs(true_rps) * 0.01) test_assert_eq(offset, true_cpr * true_rps, accuracy = 0.02) - test_curve_fit(data[:,(0,6)], fitted_curve, max_mean_err = true_cpr * 0.05, inlier_range = true_cpr * 0.05, max_outliers = len(data[:,0]) * 0.02) + test_curve_fit(data[:,(0,6)], fitted_curve, max_mean_err = true_cpr * 0.05, inlier_range = true_cpr * 0.05, max_outliers = len(data[:,0]) * 0.05) diff --git a/tools/odrive/tests/test_runner.py b/tools/odrive/tests/test_runner.py index a6dbffc0..6fc648d2 100644 --- a/tools/odrive/tests/test_runner.py +++ b/tools/odrive/tests/test_runner.py @@ -781,12 +781,12 @@ if args.setup_host: if not os.path.isdir("/sys/class/gpio/gpio{}".format(num)): with open("/sys/class/gpio/export", "w") as fp: fp.write(str(num)) - os.chmod("/sys/class/gpio/gpio{}/value".format(num), stat.S_IROTH | stat.S_IWOTH) - os.chmod("/sys/class/gpio/gpio{}/direction".format(num), stat.S_IROTH | stat.S_IWOTH) + os.chmod("/sys/class/gpio/gpio{}/value".format(num), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + os.chmod("/sys/class/gpio/gpio{}/direction".format(num), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) for port in testrig.get_components(SerialPortComponent): logger.debug('changing permissions on ' + port.yaml['port'] + '...') - os.chmod(port.yaml['port'], stat.S_IROTH | stat.S_IWOTH) + os.chmod(port.yaml['port'], stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) if len(list(testrig.get_components(TeensyComponent))): # This breaks the annoying teensy loader that shows up on every compile