Skip to content

Commit

Permalink
Add basic coverage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblock committed Jan 5, 2023
1 parent bc41bf0 commit da7fcda
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The project website is http://dfu-programmer.github.io and you can use that to c
All official [builds](https://github.com/dfu-programmer/dfu-programmer/actions) and [releases](https://github.com/dfu-programmer/dfu-programmer/releases) are on [GitHub](https://github.com/dfu-programmer/dfu-programmer).

[![Build dfu-programmer](https://github.com/dfu-programmer/dfu-programmer/actions/workflows/build.yml/badge.svg)](https://github.com/dfu-programmer/dfu-programmer/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/dfu-programmer/dfu-programmer/badge.svg?branch=master)](https://coveralls.io/github/dfu-programmer/dfu-programmer?branch=master)

## Simple install procedure for Unix/Linux/MAC

Expand Down Expand Up @@ -80,6 +81,12 @@ Atmel's [FLIP programmer](https://www.microchip.com/en-us/development-tool/flip)
It can be used to install the libusb-win32, libusbK, WinUSB, or "USB Serial (CDC)" drivers.
All but "USB Serial (CDC)" will work with dfu-programmer.

## Testing & Coverage

Since most testing depends on hardware, we've set up a simple device with a webhook that will automatically run tests with coverage reports and upload them to [Coveralls](https://coveralls.io/github/dfu-programmer/dfu-programmer).
The setup scripts are not <!-- yet? --> published.
Read more about the tests [here](test/README.md).

## Currently Supported Chips

<details><summary>8051 based controllers</summary>
Expand Down
38 changes: 38 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Tests

These tests are expected to be run on a purpose built test system.

## Goals

1. ✅ Functionality testing
2. 💯% code coverage

## Tests

Please add new tests in this directory with the `.sh` extension.
They will be run with `bash -e -x {}`.

## Current Test System

**Raspberry PI Zero W** with a **SparkFun - Pro Micro 3.3V 8MHz** connected to the USB port and via SPI.

![ActionPi - ATmega32u4 DFU Tester](https://user-images.githubusercontent.com/419955/210459911-fbdf8628-7748-4977-992a-75f027ce2bb9.png)
_Picture of test system_

The system will run the tests periodically and on trigger from a webhook.

### Software Environment

The filesystem is set to read-only, so the tests are run from a ramdisk.

Available environment variables:

- `$DFU` - The path to the recently built `dfu-programmer` executable.
- `$AVRDUDE` - A path to avrdude to needed flags. Just add "-U flash:r:-:h" to read the flash memory as hex bytes

## Minimum Test System Setup

- ATmega32u4 connected to the USB port of the test system.
- AVRDUDE setup to program the ATmega32u4
- A program on the path called `avrdude.sh` that adds the correct `-c`, `-B`, `-P`, and `-p` options to the `avrdude` command. Running without arguments should successfully communicate and identify the ATmega32u4.
- Permissions to access usb devices as the current user.
1 change: 1 addition & 0 deletions test/status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$DFU --help
1 change: 1 addition & 0 deletions test/usage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$DFU --help

0 comments on commit da7fcda

Please sign in to comment.