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

Icetea support #7745

Merged
merged 40 commits into from
Sep 2, 2018
Merged

Icetea support #7745

merged 40 commits into from
Sep 2, 2018

Conversation

OPpuolitaival
Copy link
Contributor

Description

Add icetea support including tools code and couple of example tests

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Feature
[ ] Breaking change

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My 4 comments are just because the location of entire patch here is wrong. Shouldn't this in frameworks where other test tools are?

Makefile Outdated
@@ -0,0 +1,5 @@
SRCS := $(wildcard source/*.c)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we want to have this in the root. makefile that is just for cmdline tool

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also yotta_ignore file

.mbedignore Outdated
@@ -0,0 +1,2 @@
test/*
source/ns_list_internal/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source path does not look correct, there's o source/ in the root here as .mbedignore is

.mbedignore Outdated
@@ -0,0 +1,2 @@
test/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where this comes from tests/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these comments are from one git subtree try.. I will fix these

@OPpuolitaival
Copy link
Contributor Author

@0xc0170 I will put mbed-client-cli in better place on monday when I can get support from @jarlamsa

Copy link
Member

@ithinuel ithinuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job :)

I only reviewed the python scripts. From what I understood they look good to me.

I have some concerns regarding tools/test_api.py that contains a lot of changes related to white spaces and empty lines that should probably not be part of this PR and few other little things.

tools/test.py Outdated
"""
from __future__ import print_function, division, absolute_import
import sys
import os
import json
import subprocess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subprocess is not used.

@@ -1117,4 +1117,4 @@ def report(self):
u'IAR': IAR
}

TOOLCHAINS = set(TOOLCHAIN_CLASSES.keys())
TOOLCHAINS = set(TOOLCHAIN_CLASSES.keys())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only removing a linefeed.

@@ -28,14 +28,17 @@
import random
import argparse
import datetime
import errno
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errno is not used in this file.

import threading
import ctypes
import functools
import subprocess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subprocess is not used in this file.


class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment in tools/test/run_icetea/TEST_DIR/test_pass.py.


class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment in tools/test/run_icetea/TEST_DIR/test_pass.py.


class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment in tools/test/run_icetea/TEST_DIR/test_pass.py.


class Testcase(Bench):
def __init__(self):
Bench.__init__(self,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure about this, but I usually see super() used in this case instead of invoking explicitly the Base class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried super but did not work for some reason

requirements.txt Outdated
@@ -6,7 +6,7 @@ IntelHex>=1.3
junit-xml
pyYAML
requests
mbed-ls>=0.2.13
mbed-ls>=0.2.13,<2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we add a high limit to mbed-ls version ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is syncronized with icetea. If not then there is risk that icetea and this support different version and cause problems

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this because of https://github.com/ARMmbed/icetea/blob/929dc1da4c2529fff633545c00b677d0970ee0a5/setup.py#L32
It seems we actually also need a version >=1.4.2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mbed-ls v0.2.13 is very old - maybe it's better to update this anyway..

@OPpuolitaival OPpuolitaival force-pushed the icetea branch 3 times, most recently from 1d2ea0a to a3567f2 Compare August 17, 2018 09:50
}

FileHandle* mbed::mbed_override_console(int) {
static UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, 115200);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baudrate could be defined beginning of file

int c;
while((c = getchar()) != EOF) {
cmd_char_input(c);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: wrong indent - check whole file

const char* MAN_IFCONFIG = " ifup interface up\r\n"\
" ifdown interface down\r\n";

static bool is_ipv4(const char *str)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn’t there any better/more robust way to detect whether str is ipv4 or 6?

static void ifconfig_print()
{
if(!net)
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe here should be print that no interface configured etc




const char* networkstack_error_to_str(int errorcode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks something (also) that could be shared/needed between (cli)apps, could we have shared library which contains commons stuff for testapps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be done in the future when there are multiple apps. Basically the whole command could be common stuff, but where do we draw the line that what is common between apps and what is not.

if options.verbose:
cmd(['icetea', '--tcdir', options.tcdir, '--list'] + (['-v'] if options.verbose else []))

cmd(['icetea', '--tcdir', options.tcdir, '--suite', options.test_suite, '--clean', '--plugin_path',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks that we doesn't have any way to pypass other optional icetea arguments here, any plan/chance to make it possible ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current idea is that advanced usage will happen without these scripts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How we bring remote resource support in future then? Do we bring parameters one by one when needed? Doesn’t sound good approach either 🙄

@@ -0,0 +1 @@
test_suite.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: missing empty line (same issue seems to be in multiple files)

@@ -0,0 +1,37 @@
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this file at all? what about previous one (test_pass.py) ?

def __init__(self):
Bench.__init__(self,
name="test_K64F_only",
title="Test a test case which have onely K64F support",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: typo

@@ -0,0 +1,104 @@
"""
mbed SDK
Copyright (c) 2016 ARM Limited
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016?

@@ -299,9 +314,6 @@ static void sigio_handler(SInfo *info) {
void cmd_socket_init(void)
{
cmd_add("socket", cmd_socket, "socket", MAN_SOCKET);
cmd_alias_add("socket help", "socket -h");
cmd_alias_add("socket --help", "socket -h");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe last one would be still usefull - does test uses it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one seems to be an artifact from porting. It isn't used nor implemented.

@0xc0170 0xc0170 dismissed their stale review August 20, 2018 15:42

Dismissed. Reviewing again

cmd_next(retcode);
}

void wrap_printf(const char *f, va_list a) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align the code (run astyle on these example apps)


Now that the interface has been selected you can run the icetea tests from the mbed-os root on your command line by

`>mbed test -m <target> -t <toolchain> --icetea`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked in the unittest PR, just to be sure this is fine also here (commands/arguments alignment for cli) - how we can test (unit/icetea/app tests) - using one command mbed test and --argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled in unit testing.. it add new command "mbed unittest" because it is so different than icetea or greentea

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 24, 2018

@ARMmbed/mbed-os-tools Please review tools changes

Documentation addition ARMmbed/mbed-os-5-docs#659
mbed cli addition - ARMmbed/mbed-cli#731

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good! Some doc issues and a few implementation questions but overall seems to be in good shape.


### Structure

mbed-os has a folder called TEST_APPS that contains everything related to IceTea -testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can drop the - in -testing.

- icetea-plugins - contains plugins that are being used by some of the testcases, needed for the test execution
- testcases - contains IceTea testcases written in Python

The testcases and test applications have a dependency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be something more in this sentence? What is the dependency?

### Structure

mbed-os has a folder called TEST_APPS that contains everything related to IceTea -testing.
There are currently 3 folders
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically a : should go after folders I think. Like:

There are currently 3 folders:


#### Prerequisities

You should have IceTea and forked mbed-cli that supports IceTea, installed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to remove forked from this sentence, considering that we'll be merging this into a released version of Mbed CLI.

```

The results from the tests can also be found from mbed-os/log -folder.
You probably want to add the log -folder to your .mbedignore -file to prevent issues with build commands becoming too long over the time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few stray - characters in these sentences, I'd remove them for clarity.

requirements.txt Outdated
@@ -15,3 +15,4 @@ pyelftools>=0.24
jsonschema>=2.6
future>=0.16.0
six>=1.11.0
icetea==1.0.0rc3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is using an rc release, is there a non-rc release we should be using?

Copy link
Contributor

@jupe jupe Aug 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t want to tag release before everything is ready, including OOB’s.. There is at least one doc PR landing to icetea before release.. But yes, eventually we have 1.0.0 release :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be change when release of icetea is published

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will icetea be released to 1.0.0 before this PR is merged? Is there an order to PRs that the maintainers need to be aware of?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridadan FYI, it looks like the most recent commit updates this: c6c323d

Not sure why GitHub is still showing this.

build[0]['elf'] = relpath(build[0]['elf'], path_to_file)
build[0]['bin'] = relpath(build[0]['bin'], path_to_file)
except KeyError:
pass
if 'type' not in build[0]:
build[0]['type'] = app_type
build_data['builds'].append(build[0])
dump(build_data, open(filename, "w"), indent=4, separators=(',', ': '))
build_data['builds'].insert(0, build[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build_data.json is not cleared and it will contain also failed builds. Previously the latest build was on the bottom of the build_data.json. This appends the build_data from the start so the latest build is in the top of the build_data.json. The run_icetea.py is looking this file to get all the test application binary paths and apparently read only the first build result. Other option to get the latest build is to start looking for the build date and which one is the latest, not sure if its reliable in every case. The date seems to be coming from python datetime method. (datetime.utcnow().isoformat())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being slow, can you explain this sentence a bit more?

The run_icetea.py is looking this file to get all the test application binary paths and apparently read only the first build result.

Just curious why the order is important in this particular case, this isn't a blocker issue though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously if your first build failed, the failed build data was in the top of build_data.json, if the run_icetea.py only read this failed one and tried to get the test application binary paths from this, all the tests would fail because there was no binary path found. This would also happen in the future test runs if you don't use -c or delete the build_data.json separately.
Now the script also checks that was the build successful or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see, sounds like a workaround then. Glad to hear the updated version checks the result! Thanks for the explanation

for test in icetea_json_output:
skip = False

for dut in test['requirements']['duts'].values():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be helpful to have some warnings displayed if possible in this case.

requirements.txt Outdated
@@ -15,3 +15,4 @@ pyelftools>=0.24
jsonschema>=2.6
future>=0.16.0
six>=1.11.0
icetea==1.0.0rc4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very restrictive

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not rely only on rc4 version.
Looking at other requirements >=1.0.0 would be fine?

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 29, 2018

Can you rebase? Once done, let us know

@OPpuolitaival
Copy link
Contributor Author

Rebased and works in my tests now.. @jarlamsa can you check that works in windows and your setup too

@cmonr cmonr added risk: R and removed risk: A labels Aug 29, 2018
@cmonr
Copy link
Contributor

cmonr commented Aug 30, 2018

@0xc0170 @bridadan @jupe @ithinuel @jarlamsa @donatieng @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-test If y'all could take a quick look in the next 12-24 hrs, that would be wonderful.

@jarlamsa
Copy link
Contributor

@OPpuolitaival seems to be working now

@cmonr cmonr removed the needs: work label Aug 31, 2018
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A dependency of Icetea, psutil, requires a native C/C++ compiler to install through pip. Please remove this dependency.

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icetea 1.0.1 does not have native-compiler dependencies. CI should work now.

@theotherjimmy
Copy link
Contributor

@cmonr I restarted travis. Let's get this tested.

@cmonr
Copy link
Contributor

cmonr commented Aug 31, 2018

/morph build

@cmonr cmonr added risk: A and removed risk: R labels Aug 31, 2018
@mbed-ci
Copy link

mbed-ci commented Sep 1, 2018

Build : FAILURE

Build number : 2978
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7745/

@cmonr
Copy link
Contributor

cmonr commented Sep 1, 2018

I think this is still dependent on #7814

@OPpuolitaival
Copy link
Contributor Author

@SeppoTakalo any idea why emac test build fails? Should not be related to this PR:
[DEBUG] Output: "./TESTS/network/emac/main.cpp", line 21: Error: #35: #error directive: [NOT_SUPPORTED] Requires parameters from mbed_app.json

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 1, 2018

Where do they come from? No supported is fine (should not cause CI to report failure, neither a user) , just a test that requires some additional info (no default provided )

the failures in the build examples come from connectivity PR (will be fixed asap)

@cmonr
Copy link
Contributor

cmonr commented Sep 1, 2018

#7814 is now in! Let's see if this improves things.
/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 1, 2018

Build : SUCCESS

Build number : 2983
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7745/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Sep 2, 2018

@cmonr cmonr added risk: G and removed risk: A labels Sep 2, 2018
@mbed-ci
Copy link

mbed-ci commented Sep 2, 2018

@0xc0170 0xc0170 merged commit 1eab072 into ARMmbed:master Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.