Skip to content

Commit

Permalink
Merge pull request #329 from andrewdavidmackenzie/piglet_testing
Browse files Browse the repository at this point in the history
Piglet testing
  • Loading branch information
andrewdavidmackenzie authored Aug 4, 2024
2 parents 641ab33 + 87899ff commit ebeafd3
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 150 deletions.
152 changes: 15 additions & 137 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pigg"
version = "0.3.2"
version = "0.3.3"
edition = "2021"
description = "A Graphical User Interface for interacting with local and remote Raspberry Pi Hardware"
default-run = "piggui"
Expand Down Expand Up @@ -41,15 +41,13 @@ tokio = { version = "1.39.2", default-features = false, features = ["time", "rt"

# used in piglet only
log = { version = "0.4.22", default-features = false }
env_logger = { version = "0.11.5", default-features = false }
service-manager = { version = "0.7.1", default-features = false }
sysinfo = { version = "0.31.2", default-features = false, features = ["system"] }

# used by piggui in GUI only
iced = { version = "0.12.1", default-features = false, features = ["tokio", "debug", "canvas", "advanced"] }
iced_aw = { version = "0.9.3", default-features = false, features = ["tabs", "card", "modal", "menu"] }
iced_futures = { version = "0.12.0", default-features = false }
iced_native = { version = "0.10.3", default-features = false }
plotters-iced = { version = "0.10", default-features = false }
plotters = { version = "0.3", default_features = false, features = [
"chrono",
Expand Down
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ all: clippy build test
.PHONY: cross
cross: cross-clippy cross-build cross-test cross-release-build cross-build-armv7 cross-release-build-armv7

release: release-build

.PHONY: clippy
clippy:
cargo clippy --tests --no-deps
Expand All @@ -35,27 +33,27 @@ build:

.PHONY: run
run:
cargo run --bin piggui
cargo run

.PHONY: run-release
run-release:
cargo run --bin piggui --release
cargo run --release

.PHONY: run-piglet
run-piglet:
RUST_LOG=piglet=info cargo run --bin piglet
cargo run --bin piglet

.PHONY: run-release-piglet
run-release-piglet:
RUST_LOG=piglet=info cargo run --bin piglet --release
cargo run --bin piglet --release

# This will build all binaries on the current host, be it macos, linux or raspberry pi - with release profile
.PHONY: build-release
build-release:
cargo build --release

# This will only test GUI tests in piggui on the local host, whatever that is
# We'd need to think how to run tests on RPi, on piggui with GUI and GPIO functionality, and piglet with GPIO functionality
# We'd need to think how to run tests on RºPi, on piggui with GUI and GPIO functionality, and piglet with GPIO functionality
.PHONY: test
test:
cargo test
Expand Down
6 changes: 3 additions & 3 deletions src/piglet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ async fn listen(info_path: &Path, mut hardware: impl Hardware) -> anyhow::Result
.await?;

let nodeid = endpoint.node_id();
info!("node id: {nodeid}");
println!("nodeid: {nodeid}");

let local_addrs = endpoint
.direct_addresses()
Expand All @@ -235,12 +235,12 @@ async fn listen(info_path: &Path, mut hardware: impl Hardware) -> anyhow::Result
.map(|endpoint| endpoint.addr.to_string())
.collect::<Vec<_>>()
.join(" ");
info!("local Addresses: {local_addrs}");
println!("local Addresses: {local_addrs}");

let relay_url = endpoint
.home_relay()
.expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server");
info!("node relay server url: {relay_url}");
println!("Relay URL: {relay_url}");

// write the info about the node to the info_path file for use in piggui
write_info_file(info_path, &nodeid, &local_addrs, &relay_url)?;
Expand Down
Loading

0 comments on commit ebeafd3

Please sign in to comment.