0

just started to learn rust and wanted a real project to work on. Since my raspberry-pi only came with a non-pwm fan I wanted to write a small CPU temp monitor/fan control program for the pi.

Now I want to execute some unit tests and having some problems with it. First, some information:

  • I am working on MacOS
  • I installed compile tools and am using target armv7-unknown-linux-musleabihf
  • (target gnueabihf didn't work for me, even though it is mentioned in multiple tutorials)
  • I use a raspberry-pi 4 B
  • I only use one dependency: rppal = "0.13.1"

Compiling to the raspberry-pi target works like a charm and I can execute it on the pi. But when I want to execute the tests on my MacOS the rppal dependency fails to compile.

Now I was wondering if there is a way to run tests with only compiling what is actually needed.

clash
  • 427
  • 4
  • 11
  • Does this help [How can I run cargo tests on another machine without the Rust compiler?](/q/44947640/2189130) – kmdreko Sep 25 '22 at 20:35
  • @kmdreko Thanks, At one point this (or using docker) could be an alternative, but for "fast" test driven development I was hoping for some other way to go. – clash Sep 25 '22 at 20:49
  • *"[Is there] a way to run tests with only compiling what is actually needed?"* - does this mean you don't actually use rppal in your tests? If not, you could make it an optional dependency and feature-gate it. – kmdreko Sep 25 '22 at 21:37
  • No, sorry for the confusion. If I run specific tests with cargo test (or via VSCode's "Run Test"). And these tests are unit tests for a module which doesn't interact with (in this case) rppal, it would still combile everything, including rppal, and fail to do with the target being my mac. – clash Sep 26 '22 at 06:54

0 Answers0