Skip to content

Commit 7eefcf0

Browse files
committed
feat(eppp): Added CI job to build examples and tests
1 parent 18f8452 commit 7eefcf0

17 files changed

+77
-46
lines changed

.github/workflows/eppp__build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "eppp_link: build-tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, labeled]
9+
10+
jobs:
11+
build_eppp:
12+
if: contains(github.event.pull_request.labels.*.name, 'eppp') || github.event_name == 'push'
13+
name: Build
14+
strategy:
15+
matrix:
16+
idf_ver: ["latest"]
17+
test: [ { app: host, path: "examples/host" }, { app: slave, path: "examples/slave" }, { app: test_app, path: "test/test_app" }]
18+
runs-on: ubuntu-20.04
19+
container: espressif/idf:${{ matrix.idf_ver }}
20+
steps:
21+
- name: Checkout esp-protocols
22+
uses: actions/checkout@v3
23+
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
24+
shell: bash
25+
run: |
26+
${IDF_PATH}/install.sh --enable-pytest
27+
. ${IDF_PATH}/export.sh
28+
python ./ci/build_apps.py ./components/eppp_link/${{matrix.test.path}} -vv --preserve-all

.github/workflows/publish-docs-component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
components/esp_modem;
9393
components/esp_mqtt_cxx;
9494
components/esp_websocket_client;
95+
components/eppp_link;
9596
components/mdns;
9697
components/console_simple_init;
9798
components/console_cmd_ping;

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ repos:
6161
- repo: local
6262
hooks:
6363
- id: commit message scopes
64-
name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common"
64+
name: "commit message must be scoped with: mdns, modem, websocket, asio, mqtt_cxx, console, common, eppp"
6565
entry: '\A(?!(feat|fix|ci|bump|test|docs)\((mdns|modem|common|console|websocket|asio|mqtt_cxx|examples|eppp)\)\:)'
6666
language: pygrep
6767
args: [--multiline]

components/eppp_link/.cz.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
commitizen:
3-
bump_message: 'bump(eppp_link): $current_version -> $new_version'
3+
bump_message: 'bump(eppp): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py eppp_link
5-
tag_format: epp_link-v$version
6-
version: 0.0.1
5+
tag_format: eppp-v$version
6+
version: 0.0.0
77
version_files:
88
- idf_component.yml

components/eppp_link/eppp_link.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ struct packet {
4343
#define MIN_TRIGGER_US 20
4444
#define SPI_HEADER_MAGIC 0x1234
4545

46+
static void timer_callback(void *arg);
47+
4648
struct header {
4749
uint16_t magic;
4850
uint16_t size;
@@ -85,7 +87,6 @@ struct eppp_handle {
8587
};
8688

8789

88-
8990
static esp_err_t transmit(void *h, void *buffer, size_t len)
9091
{
9192
struct eppp_handle *handle = h;
@@ -128,14 +129,6 @@ static esp_err_t transmit(void *h, void *buffer, size_t len)
128129
return ESP_OK;
129130
}
130131

131-
static void IRAM_ATTR timer_callback(void *arg)
132-
{
133-
struct eppp_handle *h = arg;
134-
if (h->blocked == SLAVE_WANTS_WRITE) {
135-
gpio_set_level(h->gpio_intr, 0);
136-
}
137-
}
138-
139132
static void netif_deinit(esp_netif_t *netif)
140133
{
141134
if (netif == NULL) {
@@ -332,7 +325,15 @@ static void on_ip_event(void *arg, esp_event_base_t base, int32_t event_id, void
332325

333326
#define SPI_ALIGN(size) (((size) + 3U) & ~(3U))
334327
#define TRANSFER_SIZE SPI_ALIGN((MAX_PAYLOAD + 6))
335-
#define MAX(a,b) (((a)>(b))?(a):(b))
328+
#define NEXT_TRANSACTION_SIZE(a,b) (((a)>(b))?(a):(b)) /* next transaction: whichever is bigger */
329+
330+
static void IRAM_ATTR timer_callback(void *arg)
331+
{
332+
struct eppp_handle *h = arg;
333+
if (h->blocked == SLAVE_WANTS_WRITE) {
334+
gpio_set_level(h->gpio_intr, 0);
335+
}
336+
}
336337

337338
static void IRAM_ATTR gpio_isr_handler(void *arg)
338339
{
@@ -598,7 +599,7 @@ esp_err_t eppp_perform(esp_netif_t *netif)
598599
ESP_LOG_BUFFER_HEXDUMP(TAG, in_buf + sizeof(struct header), head->size, ESP_LOG_VERBOSE);
599600
esp_netif_receive(netif, in_buf + sizeof(struct header), head->size, NULL);
600601
}
601-
h->transaction_size = MAX(next_tx_size, head->next_size);
602+
h->transaction_size = NEXT_TRANSACTION_SIZE(next_tx_size, head->next_size);
602603
return ESP_OK;
603604
}
604605

components/eppp_link/examples/host/main/app_main.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,23 @@ void app_main(void)
121121
dns.ip.type = ESP_IPADDR_TYPE_V4;
122122
ESP_ERROR_CHECK(esp_netif_set_dns_info(eppp_netif, ESP_NETIF_DNS_MAIN, &dns));
123123

124+
// Initialize console REPL
125+
ESP_ERROR_CHECK(console_cmd_init());
126+
124127
#if CONFIG_EXAMPLE_IPERF
125128
register_iperf();
126129

127130
printf("\n =======================================================\n");
128-
printf(" | Steps to Test PPP Client Bandwidth |\n");
131+
printf(" | Steps to Test EPPP-host bandwidth |\n");
129132
printf(" | |\n");
130-
printf(" | 1. Enter 'help', check all supported commands |\n");
131-
printf(" | 2. Start PPP server on host system |\n");
132-
printf(" | - pppd /dev/ttyUSB1 115200 192.168.11.1:192.168.11.2 modem local noauth debug nocrtscts nodetach +ipv6\n");
133-
printf(" | 3. Wait ESP32 to get IP from PPP server |\n");
134-
printf(" | 4. Enter 'pppd info' (optional) |\n");
135-
printf(" | 5. Server: 'iperf -u -s -i 3' |\n");
136-
printf(" | 6. Client: 'iperf -u -c SERVER_IP -t 60 -i 3' |\n");
133+
printf(" | 1. Wait for the ESP32 to get an IP |\n");
134+
printf(" | 2. Server: 'iperf -u -s -i 3' (on host) |\n");
135+
printf(" | 3. Client: 'iperf -u -c SERVER_IP -t 60 -i 3' |\n");
137136
printf(" | |\n");
138137
printf(" =======================================================\n\n");
139138

140139
#endif // CONFIG_EXAMPLE_IPERF
141140

142-
// Initialize console REPL
143-
ESP_ERROR_CHECK(console_cmd_init());
144-
145141
// Register the ping command
146142
ESP_ERROR_CHECK(console_cmd_ping_register());
147143
// start console REPL
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_EPPP_LINK_DEVICE_SPI=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_EPPP_LINK_DEVICE_UART=y

components/eppp_link/examples/host/sdkconfig.defaults

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# This file was generated using idf.py save-defconfig. It can be edited manually.
2-
# Espressif IoT Development Framework (ESP-IDF) 5.3.0 Project Minimal Configuration
3-
#
4-
CONFIG_UART_ISR_IN_IRAM=y
51
CONFIG_LWIP_PPP_SUPPORT=y
62
CONFIG_LWIP_PPP_SERVER_SUPPORT=y
73
CONFIG_LWIP_PPP_VJ_HEADER_COMPRESSION=n
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
idf_component_register(SRCS "station_example_main.c"
1+
idf_component_register(SRCS "eppp_slave.c"
22
INCLUDE_DIRS ".")

0 commit comments

Comments
 (0)