Hello,
I’ve started looking into unit testing. I created a new file test.test_embedded/test_main.cpp. Here’s its content:
#include <Arduino.h>
#include "unity.h"
void test_blank(){
int i = 5;
TEST_ASSERT_EQUAL(i, 5);
}
// setup connects serial, runs test cases (upcoming)
void setup() {
delay(2000);
//
UNITY_BEGIN();
// calls to tests will go here
RUN_TEST(test_blank);
UNITY_END();
}
void loop() {
// nothing to be done here.
}
Here’s my platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.partitions = partition_table.csv
test_ignore = test_desktop
[env:native]
platform = native
test_ignore = test_embedded
And here’s the output I get when running the test:
$ pio test -e esp32dev
Verbose mode can be enabled via `-v, --verbose` option
Collected 2 items
Processing test_embedded in esp32dev environment
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building...
Uploading...
Connecting....
Writing at 0x00001000... (100 %)
Wrote 16848 bytes (10928 compressed) at 0x00001000 in 0.1 seconds (effective 1075.0 kbit/s)...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 7996.8 kbit/s)...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 35894.2 kbit/s)...
Writing at 0x00010000... (14 %)
Writing at 0x00020000... (71 %)
Wrote 205216 bytes (102652 compressed) at 0x00010000 in 1.6 seconds (effective 1009.2 kbit/s)...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6412
entry 0x400806a8
Nothing happens after that, even after a few minutes. Pressing RST on my ESP32 adds the following lines to the output:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6412
entry 0x400806a8
Once again, nothing happens after that.
I’m new to Platformio, I’ve looked into the tutorials on Unit Testing, and it seems that this should provide a vastly different output.
Could you please explain to me what I’m doing wrong?