Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create functional testing suite #277

Closed
22 tasks done
peplin opened this issue Sep 20, 2014 · 1 comment
Closed
22 tasks done

Create functional testing suite #277

peplin opened this issue Sep 20, 2014 · 1 comment
Assignees

Comments

@peplin
Copy link
Member

peplin commented Sep 20, 2014

The currently lacks a good functional testing suite - i.e. something that runs on the actual VI hardware. We're really good as far as unit tests for the code that be compiled with a desktop C compiler (we're using LLVM's Clang these days) - 91% coverage! - but there are still some critical pieces of code that can only run on the target platform. One spot that's been a source of bugs in the past in the CAN acceptance filter configuration. This is some of my least favorite code in the entire project.

With that in mind, I'd like to take the few latest VI bugs that @zacnelson has reported (thanks, Zac) and use that to drive the creation of a functional test suite.

What Are We Trying to Test?

First up are a few tests of USB in isolation:

  • Detect the USB device
  • Query for version
  • Query for device ID

Then, there are some integration tests that check both sending commands via USB and reading VI output at the same time they check that the VI's CAN controllers are configured properly. In all of these tests, each CAN controller is configured in loopback mode so a message sent on the bus is also received on that bus without requiring a physical loopback cable (e.g. to connect CAN1 to CAN2). If we want to also test the physical connection (e.g. when building a new VI) we could have another testing firmware build that requires a physical loopback.

For each controller (CAN1 and CAN2):

  • Send CAN message and (after it loops back) receive that CAN message through USB
  • Send a writable simple vehicle message via USB, receive that simple vehicle message via USB after it loops back
  • Send a diagnostic request via USB, receive CAN message output after it loops back and verify
  • Send a CAN message that contains a diagnostic response, receive diagnostic response output via USB after it loops back
  • Send a CAN message that contains a diagnostic response, receive diagnostic response formatted with OBD-II output handler via USB after it loops back
  • Add a recurring diagnostic request, confirm outgoing CAN messages
  • Cancel recurring diagnostic request, confirm no outgoing CAN messages
  • With CAN AF configured, send a message not in AF and confirm nothing is received.
    • Receipt of message matching AF is tested earlier
  • With CAN AF in bypass, confirm both predefined and unrecognized CAN messages are received
  • Dynamically turn bus 1 AF on, verify the AF can still be changed on the fly for diagnostic requests (right now because of global AF on LPC17xx, only really testing our software AF with the test firmware build)
  • Test pre-defined OBD2 PIDs, received as simple vehicle messages
  • Test sending and receiving extend CAN frames

TODO

Future Work

  • A version of the testing firmware that requires a physical loopback cable (i.e. connecting CAN1 to CAN2) so we can make sure the physical connection is operational. This cable would require the termination resistors, I think. I've made one before for manufacturing testing for the Ford reference VI and it worked well.
  • Implement as much of this as possible as a self-test mode in the VI so it doesn't require an external driver. It should be really, really fast, so it could theoretically run every time it boots up.
@peplin
Copy link
Member Author

peplin commented Sep 30, 2014

For the most part, done!

Split out into a few other issues (#297, #298, #300) and need to run the tests on the chipKIT and C5 to see if it can catch the reported issues with CAN2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant