A few small changes to the C++ ITs

A PDP channel number is correct now, the deploy script was changed to
kill Java programs before running and ignore useless messages,
the "Waiting for enable" message is only printed once, and the accelerometer
test is more robust.

Change-Id: I2226140d8c3e44c452e039c27f4f1cf11c952c42
This commit is contained in:
thomasclark
2014-07-24 18:19:43 -04:00
parent 2481e98bc8
commit fdbe750d3d
5 changed files with 19 additions and 15 deletions

View File

@@ -4,9 +4,10 @@
if [ $(which sshpass) ]
then
sshpass -p "" ssh admin@10.1.90.2 killall FRCUserProgram
sshpass -p "" scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin
sshpass -p "" ssh admin@10.1.90.2 ./FRCUserProgram --gtest_color=yes $*
# Send stderr to /dev/null - the only thing printed to it is the login prompt
sshpass -p "" ssh admin@10.1.90.2 killall FRCUserProgram java 2> /dev/null
sshpass -p "" scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin 2> /dev/null
sshpass -p "" ssh admin@10.1.90.2 ./FRCUserProgram --gtest_color=yes $* 2> /dev/null
else
ssh admin@10.1.90.2 killall FRCUserProgram
scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin

View File

@@ -57,6 +57,6 @@ public:
/* PDP channels */
static const uint32_t kJaguarPDPChannel = 6;
static const uint32_t kVictorPDPChannel = 10;
static const uint32_t kVictorPDPChannel = 8;
static const uint32_t kTalonPDPChannel = 11;
};

View File

@@ -8,8 +8,7 @@
#include "WPILib.h"
#include "gtest/gtest.h"
static constexpr double accelerationTolerance = 0.1;
static constexpr double kAccelerationTolerance = 0.1;
/**
* There's not much we can automatically test with the on-board accelerometer,
* but checking for gravity is probably good enough to tell that it's working.
@@ -17,7 +16,11 @@ static constexpr double accelerationTolerance = 0.1;
TEST(AccelerometerTest, Accelerometer) {
BuiltInAccelerometer accelerometer;
ASSERT_NEAR(0.0, accelerometer.GetX(), accelerationTolerance);
ASSERT_NEAR(0.0, accelerometer.GetY(), accelerationTolerance);
ASSERT_NEAR(1.0, accelerometer.GetZ(), accelerationTolerance);
/* The testbench sometimes shakes a little from a previous test. Give it
some time. */
Wait(1.0);
ASSERT_NEAR(0.0, accelerometer.GetX(), kAccelerationTolerance);
ASSERT_NEAR(0.0, accelerometer.GetY(), kAccelerationTolerance);
ASSERT_NEAR(1.0, accelerometer.GetZ(), kAccelerationTolerance);
}

View File

@@ -15,23 +15,23 @@ public:
std::cerr << "FATAL ERROR: HAL could not be initialized" << std::endl;
exit(-1);
}
/* This sets up the network communications library to enable the driver
station. After starting network coms, it will loop until the driver
station returns that the robot is enabled, to ensure that tests will be
able to run on the hardware. */
able to run on the hardware. */
HALNetworkCommunicationObserveUserProgramStarting();
LiveWindow::GetInstance()->SetEnabled(false);
std::cout << "Waiting for enable" << std::endl;
while(!DriverStation::GetInstance()->IsEnabled()) {
Wait(0.1);
std::cout << "Waiting for enable" << std::endl;
}
}
virtual void TearDown() {
}
};
testing::Environment *const environment = testing::AddGlobalTestEnvironment(new TestEnvironment);