Skip to content

Use test macros in phold and timerfd tests, fix bugs#1131

Merged
robgjansen merged 7 commits intoshadow:devfrom
robgjansen:phold-timerfd-tests
Mar 1, 2021
Merged

Use test macros in phold and timerfd tests, fix bugs#1131
robgjansen merged 7 commits intoshadow:devfrom
robgjansen:phold-timerfd-tests

Conversation

@robgjansen
Copy link
Copy Markdown
Member

This PR finishes converting the remaining tests to the new macros:

  • Using the new test macros, the phold test previously failed because it did not ever return 0. This fixes the test so that we can specify a phold runtime independent of the stop time for the simulation.
  • The timerfd test was failing and we didn't notice it. Using the new test macros made the failing test apparent. Now we also test it using all interpose methods.

@robgjansen robgjansen added Type: Maintenance Refactoring, cleanup, documenation, or process improvements Component: Testing Unit and integration tests and frameworks labels Mar 1, 2021
@robgjansen robgjansen added this to the Code health and maintenance milestone Mar 1, 2021
@robgjansen robgjansen self-assigned this Mar 1, 2021
@stevenengler
Copy link
Copy Markdown
Contributor

Related: #902 for the phold and timerfd tests.

if(emNanoSecs >= EMULATED_TIME_OFFSET) {
simNanoSecs = EMULATED_TIME_TO_SIMULATED_TIME(emNanoSecs);
} else {
simNanoSecs = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How do we get here, and why do we want to set to zero in that case?

## TODO swap the following lines when all tests have been converted to the macros
#set_tests_properties(leakcheck-shadow-grep PROPERTIES DEPENDS "${ALL_SHADOW_TESTS}")
set_tests_properties(leakcheck-shadow-grep PROPERTIES DEPENDS "bind-shadow-ptrace;bind-shadow-preload;clone-shadow-ptrace;config-convert-shadow;cpp-shadow-ptrace;cpp-shadow-preload;epoll-shadow-ptrace;epoll-writeable-shadow-ptrace;eventfd-shadow-ptrace;eventfd-shadow-preload;file-shadow-ptrace;mmap-shadow-ptrace;phold-shadow-ptrace;phold-threaded-shadow-ptrace;random-shadow-ptrace;random-shadow-preload;shutdown-shadow-ptrace;shutdown-shadow-preload;sleep-shadow-ptrace;sleep-shadow-preload;sockbuf-shadow-ptrace;socket-shadow-ptrace;socket-shadow-preload;bind-shadow-ptrace;bind-shadow-preload;listen-shadow-ptrace;listen-shadow-preload;getsockname-shadow-ptrace;getsockname-shadow-preload;accept-shadow-ptrace;accept-shadow-preload;timerfd-shadow-ptrace;udp-uniprocess-shadow-ptrace;udp-uniprocess-shadow-preload;udp-shadow-ptrace;unistd-shadow-ptrace;unistd-shadow-preload")
set_tests_properties(leakcheck-shadow-grep PROPERTIES DEPENDS "${ALL_SHADOW_TESTS}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Woohoo!

@@ -0,0 +1 @@
phold.yaml No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh; I guess this is an 'include'? I didn't know yaml supported that; SO seems to think it doesn't :). Since this isn't standard yaml could probably use a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's a symbolic link checked into the repo.

@@ -0,0 +1 @@
phold.yaml No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment how this works?

@sporksmith
Copy link
Copy Markdown
Contributor

Oh huh, just noticed this is marked as a draft. I got an email notification for the PR and misinterpreted it as a review request 🤦‍♂️

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 1, 2021

Codecov Report

Merging #1131 (b687e1f) into dev (7c0c688) will increase coverage by 1.10%.
The diff coverage is 67.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1131      +/-   ##
==========================================
+ Coverage   55.96%   57.07%   +1.10%     
==========================================
  Files         136      136              
  Lines       20158    20133      -25     
  Branches     4830     4842      +12     
==========================================
+ Hits        11282    11491     +209     
+ Misses       5964     5669     -295     
- Partials     2912     2973      +61     
Flag Coverage Δ
tests 57.07% <67.04%> (+1.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/test/timerfd/test_timerfd.c 68.96% <57.14%> (+6.95%) ⬆️
src/test/phold/test_phold.c 69.20% <87.50%> (+69.20%) ⬆️
src/main/host/descriptor/timer.c 70.90% <100.00%> (+2.58%) ⬆️
src/main/host/thread_ptrace.c 65.55% <0.00%> (-1.75%) ⬇️
src/main/host/process.c 72.16% <0.00%> (-1.36%) ⬇️
src/main/utility/utility.c 23.90% <0.00%> (-0.98%) ⬇️
src/main/core/scheduler/scheduler.c 77.74% <0.00%> (+0.33%) ⬆️
src/shim/preload_syscalls.c 43.51% <0.00%> (+1.85%) ⬆️
src/support/logger/log_level.c 48.00% <0.00%> (+8.00%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c0c688...8946c6e. Read the comment docs.

@robgjansen robgjansen marked this pull request as ready for review March 1, 2021 19:45
@robgjansen
Copy link
Copy Markdown
Member Author

Thanks for the preemptive review :)

@robgjansen robgjansen merged commit b72c1cf into shadow:dev Mar 1, 2021
@robgjansen robgjansen deleted the phold-timerfd-tests branch March 1, 2021 19:46
@sporksmith sporksmith mentioned this pull request Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Testing Unit and integration tests and frameworks Type: Maintenance Refactoring, cleanup, documenation, or process improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants