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

sanitycheck: Execute binary in output directory #16149

Merged
merged 1 commit into from
May 23, 2019

Conversation

vanwinkeljan
Copy link
Member

Execute the test binary from the output directory instead of directory
where sanitycheck was started.

This will ensure that any artifact created with a relative path by the
test binary will be placed in the output directory instead of creating
the artifact in the directory where sanitycheck was executed and prevent
any possible conflicts.

One of the use case is the flash support for native posix (PR #12503) which
will create a binary file that stores the flash contents.

@vanwinkeljan vanwinkeljan added the area: Sanitycheck Sanitycheck has been renamed to Twister label May 14, 2019
@vanwinkeljan vanwinkeljan requested review from nashif and galak May 14, 2019 17:22
@marc-hb marc-hb requested a review from andrewboie May 16, 2019 17:49
scripts/sanitycheck Outdated Show resolved Hide resolved
Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Looks good if you can confirm that:

  • the case self.call_make_run = True has been tested at least once;
  • '\n' is portable, and
  • the verbose statement looks OK. Can you copy/paste a sample log output here?

scripts/sanitycheck Outdated Show resolved Hide resolved
Execute the test binary from the output directory instead of directory
where sanitycheck was started.

This will ensure that any artifact created with a relative path by the
test binary will be placed in the output directory instead of creating
the artifact in the directory where sanitycheck was executed and prevent
any possible conflicts.

Signed-off-by: Jan Van Winkel <[email protected]>
@vanwinkeljan
Copy link
Member Author

  • the case self.call_make_run = True has been tested at least once;

It has been tested by running the crc unit test (see output bellow)

  • '\n' is portable, and

No it is not, was a bit in a hurry and forgot to use os.linesep

  • the verbose statement looks OK. Can you copy/paste a sample log output here?

Output for running native posix binary:

Spawning process: /srv/workspace/dxplore/zephyr/code/zephyr/tests/subsys/fs/fat_fs_api/sanity-out/native_posix/tests/subsys/fs/fat_fs_api/filesystem.fat/zephyr/zephyr.exe
Spawning process in directory: /srv/workspace/dxplore/zephyr/code/zephyr/tests/subsys/fs/fat_fs_api/sanity-out/native_posix/tests/subsys/fs/fat_fs_api/filesystem.fat
Spawning BinaryHandler Thread for native_posix/tests/subsys/fs/fat_fs_api/filesystem.fat

Output running unit tetst:

Spawning process: /srv/workspace/dxplore/zephyr/code/zephyr/tests/unit/lib/sanity-out/unit_testing/tests/unit/lib/crc/misc.crc/testbinary
Spawning process in directory: /srv/workspace/dxplore/zephyr/code/zephyr/tests/unit/lib/sanity-out/unit_testing/tests/unit/lib/crc/misc.crc
Spawning BinaryHandler Thread for unit_testing/tests/unit/lib/crc/misc.crc

@vanwinkeljan vanwinkeljan requested a review from marc-hb May 22, 2019 12:22
@marc-hb marc-hb requested a review from carlescufi May 22, 2019 18:08
Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

I just spent more than a split second looking at this particular EOL situation. As usual with EOLs it's a mess:

  • The verbose() function here uses '\n' anyway
  • it started re-inventing python's logging module
  • Python's documentation says: "Do not use os.linesep as a line terminator when writing files opened in text mode (the default); use a single '\n' instead, on all platforms."
  • verbose() uses sys.stdout.write(). Does Python open sys.stdout in text mode? I don't know.

Let's not care. Let's leave those questions as a (search and replace) exercise for whoever will tackle the much bigger task of porting sanitycheck to Windows (#2664).

@nashif nashif merged commit 6b9e160 into zephyrproject-rtos:master May 23, 2019
@vanwinkeljan vanwinkeljan deleted the sanity_output_dir branch May 23, 2019 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sanitycheck Sanitycheck has been renamed to Twister
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants