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

make: unify app folder search (examples/*, tests/*, ...) #9867

Merged
merged 4 commits into from
Sep 6, 2018

Conversation

kaspar030
Copy link
Contributor

Contribution description

There were at least three variants of getting a list of examples and tests application folders at even more places in the code.

This PR tries to unify this.

Testing procedure

  1. murdock total job count shouldn't change
  2. complile_test output looks as before
  3. main folder make clean / distclean works as before

@kaspar030 kaspar030 added Area: build system Area: Build system Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 30, 2018
@kaspar030 kaspar030 requested review from cladmi and aabadie August 30, 2018 21:49
@kaspar030 kaspar030 force-pushed the pr/unify_app_folder_search branch from b629d33 to 4a5aee8 Compare August 30, 2018 21:49
@kaspar030
Copy link
Contributor Author

@cladmi didn't you have a PR for this somewhere already?

@kaspar030 kaspar030 changed the title Pr/unify app folder search make: unify app folder search (examples/*, tests/*, ...) Aug 30, 2018
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

I tested this PR locally and everything is fine.
It also fixes error messages (find: ‘./examples/hello-world/bin’: No such file or directory) that were displayed from time to time when calling distclean.

There are flake8 issues in this PR, as reported by the cI. And since compile_test.py is touched and already contains flake8 issues, there are unrelated issues raised as well. I'll push a PR for this.

@@ -83,12 +85,31 @@ def get_results_and_output_from(fd):
elif read_more_output:
output.write(line)

def get_app_dirs():
yield from check_output(["make", "-f", "makefiles/app_dirs.inc.mk", "info-apps"]) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for using yield from ?

@aabadie
Copy link
Contributor

aabadie commented Aug 31, 2018

@kaspar030, this needs rebase now that #9868 is merged.

@kaspar030 kaspar030 force-pushed the pr/unify_app_folder_search branch 3 times, most recently from 83180a1 to 80ecb71 Compare August 31, 2018 13:07
@kaspar030 kaspar030 mentioned this pull request Aug 31, 2018
2 tasks
@kaspar030
Copy link
Contributor Author

rebased

@kaspar030
Copy link
Contributor Author

There are flake8 issues in this PR, as reported by the cI.

Fixed. (I accidentally squashed, sorry).

@cladmi
Copy link
Contributor

cladmi commented Sep 3, 2018

@kaspar030 No I only had a test branch that I never pushed and lost.

# 2. use patsubst to drop trailing "/"
# 3. use patsubst to drop possible leading "./"
# 4. sort
APP_DIRS := $(sort $(patsubst ./%,%,$(patsubst %/,%,$(dir $(wildcard \
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not like the APP_ I would prefer APPLICATION_DIRS.

In Rapstore we think about putting multiple Apps in one RIOT APPLICATION, using the abbreviation here does not help with the confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

folder, app = app_dir.split("/", 1)
res[folder].append(app)

return res
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 is better to return a normal dict return dict(res) as using a default dict without knowing it is one can lead to trouble.

Copy link
Contributor

@cladmi cladmi Sep 3, 2018

Choose a reason for hiding this comment

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

I do not find any reference about it anymore tough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

then let's keep it.

@cladmi
Copy link
Contributor

cladmi commented Sep 3, 2018

The other things I had in my branch and that I can propose with upcoming PRs is:

  • having a APPLICATION_DIRS_REGEX variable
  • APPLICATION_DIRS_EXCLUDE to filter-out something. For testing, I often want to run everything, except one I know is broken or that works but takes too long.

Something I am thinking about but not drafted yet, is move the examples/* and tests/* definition to files in the examples and tests directories. With the goal that each package could list his tests.

$(RIOTBASE)/tests/*/Makefile \
)))))

info-apps:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I would use applications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

Globally ok, found one issue with python2.

@@ -86,12 +89,33 @@ def get_results_and_output_from(fd):
output.write(line)


def get_app_dirs():
yield from check_output(["make", "-f", "makefiles/app_dirs.inc.mk", "info-applications"]) \
Copy link
Contributor

Choose a reason for hiding this comment

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

The script is currently supposed to be python2 compatible and python2 is used by default on ubuntu because of the shebang. yield from breaks this compatibility.

Also here, as split returns a list and not a generator, yield from adds nothing.
Even check_output and decode are not generator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, it is just returning now.

Copy link
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

Tested dist/tools/compile_test/compile_test.py on ubuntu stable (python->python2) / arch (python->python3) apps are split as before.

make distclean works correctly.

make info-applications too.

I did not check the number of jobs compared to master in murdock.

@aabadie please tell when you agree to squash.

@kaspar030
Copy link
Contributor Author

@aabadie please tell when you agree to squash.

As @aabadie's comment was addressed, I already squashed. Let's still give @aabadie a chance to take a last look.

@kaspar030 kaspar030 force-pushed the pr/unify_app_folder_search branch from 9a11f4a to de55265 Compare September 5, 2018 10:04
@aabadie
Copy link
Contributor

aabadie commented Sep 6, 2018

Nothing else to add from my side. Let's merge this one.

@aabadie aabadie merged commit 0c1a207 into RIOT-OS:master Sep 6, 2018
@kaspar030 kaspar030 deleted the pr/unify_app_folder_search branch September 8, 2018 08:21
@jia200x jia200x added this to the Release 2018.10 milestone Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants