Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"pio test" does not install platform, leading to "Error: Unknown development platform" #3901

Closed
1 task done
maxgerhardt opened this issue Mar 25, 2021 · 12 comments
Closed
1 task done

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Mar 25, 2021

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Windows 10 x64

PlatformIO Version (platformio --version): PlatformIO Core, version 5.2.0a3

Description of problem

Attempting to execute a pio test command for a platform that is not yet locally installed gives

$ pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'

If one does pio platform install native and then reruns the command, it works.

Use case is per https://community.platformio.org/t/cannot-install-platform-espressif32-on-docker-ubuntu-rolling-pio-4-3-4-1/20243 in an automated CI environment where one does not want to build a native firmware but just run native unit tests.

Steps to Reproduce

  1. Create an arbitrary new project (e.g. pio init -b uno)
  2. Overwrite the platformio.ini with
[env:native]
platform = native
  1. Create a file test\test1.cpp with content
#include <unity.h>

void TrivialTestCase(void)
{
    TEST_ASSERT_EQUAL(32, 32);
}

int main() {
    UNITY_BEGIN();
    RUN_TEST(TrivialTestCase);
    UNITY_END();
    return 0;
}
  1. Delete the folder C:\Users\<user>\.platformio\platforms\native
  2. Run pio test -e native

Actual Results

>pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'

Expected Results

Expected results are present after

>pio platform install native
Platform Manager: Installing native
Platform Manager: native @ 1.1.3 has been installed!
The platform 'native' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.

>pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
------------------------------------------------------------------------------------------------------------------------
Building...
Testing...
test\test1.cpp:10:TrivialTestCase       [PASSED]

-----------------------
1 Tests 0 Failures 0 Ignored
OK
============================================== [PASSED] Took 0.99 seconds ==============================================

Test    Environment    Status    Duration
------  -------------  --------  ------------
*       native         PASSED    00:00:00.987
============================================= 1 succeeded in 00:00:00.987 =============================================

If problems with PlatformIO Build System:

The content of platformio.ini:
Per above
Source file to reproduce issue:
per above

Additional info

@mcspr
Copy link
Contributor

mcspr commented Mar 25, 2021

will also resolve platformio/platform-native#12 (ref. my comment platformio/platform-native#12 (comment))
(was just about to write an issue...)

@donnm
Copy link

donnm commented Mar 25, 2021

I'm having this issue too:

$ pio platform install atmelavr 
PlatformManager: Installing atmelavr
Error: Detected unknown package 'atmelavr'

The reason this is failing is because the HTTP request to http://dl.platformio.org/platforms/manifest.json results in HTTP/1.1 404 Not Found.

For what it's worth the error message Error: Detected unknown package 'atmelavr' could be more descriptive.

@maxgerhardt
Copy link
Contributor Author

What is pio --version? Some 4.x version or 5.x?

@donnm
Copy link

donnm commented Mar 25, 2021

PlatformIO, version 4.3.4 for me.

@maxgerhardt
Copy link
Contributor Author

maxgerhardt commented Mar 25, 2021

Mhm I have a feeling some of the stuff for the old 1-year old 4.x core was shut down :O. Is it viable for you to try and upgrade the PlatformIO core to 5.x? (pio upgrade).

But it seems that this is a seperate issue from pio test not installing the platform -- even if you try to install the platform as shown, PIO doesn't find it (in the 4.x core).

CC @ivankravets due to the importance of this issue and backwards compatibility.

@donnm
Copy link

donnm commented Mar 25, 2021

@maxgerhardt Upgrading to 5.1.1 fixed my issue. +1 for backwards compatibility.

@donnm
Copy link

donnm commented Mar 25, 2021

I can confirm this issue with 5.1.1 on Debian:

$ pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
---------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'
$ pio --version
PlatformIO Core, version 5.1.1
$ cat platformio.ini 
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:uno]
platform = atmelavr
board = uno
framework = arduino

[env:native]
platform = native
$ ls ~/.platformio/platforms/
atmelavr  espressif8266

@maxgerhardt
Copy link
Contributor Author

And it is confirmed fixed after you've run pio platform install native right?

@donnm
Copy link

donnm commented Mar 25, 2021

Yes.

@ivankravets
Copy link
Member

Sorry for the issue. Please re-test with pio upgrade --dev.

@puzrin , we would be thankful if you switch your CI to PlatformIO Core Dev. We have a lot of tests and each our commit is very stable but sometime issues happen. So, could add this line

pio upgrade --dev

after pip install -U platformio? in https://github.com/speedcontrols/ac_sc_grinder/blob/master/.github/workflows/ci.yml#L19 The final code:

          pip install -U platformio
          platformio upgrade --dev          
          platformio update

@puzrin
Copy link

puzrin commented Apr 1, 2021

Tested in branch. It works https://github.com/speedcontrols/ac_sc_grinder/actions/runs/709580960.

@ivankravets
Copy link
Member

@puzrin please keep --dev branch and report us if you encounter any issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants