Repository navigation
TraceSelect: reject bad arguments, accept -h and --help #886
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
Open
mernst
wants to merge
45
commits into
codespecs:master
Choose a base branch
from
mernst:traceselect-args
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a95b881
Reject bad command-line options with a non-zero exit status
mernst 2356213
TraceSelect: reject bad arguments, accept -h and --help, reset state …
mernst 6380a6a
Remove stale comment in DtraceDiff
mernst 13b29da
Merge branch 'bad-option-core' into traceselect-args
mernst 23bf08d
Address code review: reject "- " with no short options, report instru…
mernst d20d9f8
Merge remote-tracking branch 'origin/bad-option-core' into bad-option…
mernst 0242d85
Address code review: recognize -h in instrumenter, fix runcluster.pl …
mernst 9fc85fa
Address code review: SplitterFactoryTest.mainHelper throws instead of…
mernst ada0caf
Provide DaikonGetopt helpers that the per-tool PRs use; leave instrum…
mernst 2ace21b
Merge remote-tracking branch 'origin/bad-option-core' into traceselec…
mernst e560e3e
Merge branch 'master' of https://github.com/codespecs/daikon into bad…
mernst b9b22ec
Merge remote-tracking branch 'origin/bad-option-core' into traceselec…
mernst 7a0aa92
TraceSelect: pass the random generator to MultiRandSelector so -SEED …
mernst 7b0bd65
Address code review: make TraceSelect state local, honor -SEED, check…
mernst 131c990
Merge remote-tracking branch 'origin/traceselect-args' into tracesele…
mernst 1f929b4
Address code review: TraceSelect sample names, -o, in-process PrintIn…
mernst e82b4b5
Add a same-seed TraceSelect sampling test; skip empty invocations whe…
mernst 166c435
Make PrintInvariants, MultiDiff, and Daikon.cleanup safe to call more…
mernst 27efa4f
Address code review: TraceSelect argument checks, compressed traces, …
mernst beeb763
Merge branch 'repeatable-mainhelper' into traceselect-args
mernst e8abacc
Move the runtimechecker changes to the runtimechecker-options branch
mernst 2ace4a6
Merge branch 'bad-option-core' of github.com:mernst/daikon into trace…
mernst bf87643
Reset more static state so that mainHelper can be called repeatedly
mernst 2b46b30
Address code review: remove unused DaikonGetopt helpers, reject stray…
mernst a3de9c7
Drop PrintInvariants repeatability changes; keep only Daikon and Mult…
mernst 50e3e2a
Simplify DaikonGetopt: one constructor, which always handles -h and -…
mernst 84d0a60
TraceSelect calls Daikon.mainHelper, not Daikon.main; remove reinitia…
mernst 7df7f23
Move test-driver fixes and doc spelling fixes to separate pull requests
mernst 4f54694
Handle DaikonTerminationException in SampleTester and SplitterFactory…
mernst 680a814
TraceSelect: catch only checked exceptions, so DaikonTerminationExcep…
mernst 117da2e
Brevity
mernst 3bee663
Merge branch 'master' into bad-option-core
mernst 50fedfb
Merge branch 'bad-option-core' into traceselect-args
mernst fb04d1a
Merge branch 'repeatable-mainhelper' into traceselect-args
mernst 45c4d00
Merge branch 'master' of github.com:codespecs/daikon into traceselect…
mernst 21a3377
Add the DaikonGetopt helper that this pull request uses: argsAfterLea…
mernst 081553d
TraceSelect: reset Daikon state before checking arguments; report tra…
mernst e60d34d
Comments
mernst 930b948
DtracePartitioner: propagate I/O errors instead of printing a stack t…
mernst 79b88be
BadOptionTest: correct the comment about resetting Daikon state
mernst 1e0c017
Merge branch 'master' into traceselect-args
mernst 8432498
Merge branch 'master' into traceselect-args
mernst 427b394
Merge codespecs/daikon master into traceselect-args
mernst e4638cb
TraceSelect: don't treat a Daikon option's value as the trace file; r…
mernst 52ac66c
TraceSelect: report a TraceSelect option that follows the Daikon argu…
mernst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package daikon.test; | ||
|
|
||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||
| import static org.junit.Assert.assertEquals; | ||
|
|
||
| import daikon.tools.TraceSelect; | ||
| import java.io.IOException; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.List; | ||
| import java.util.Random; | ||
| import org.junit.Test; | ||
|
|
||
| /** Tests the TraceSelect tool. */ | ||
| public class TraceSelectTest { | ||
|
|
||
| /** The number of invocations in the trace file created by {@link #writeTrace}. */ | ||
| private static final int NUM_INVOCATIONS = 20; | ||
|
|
||
| /** | ||
| * Writes a trace file with {@link #NUM_INVOCATIONS} invocations of one method. | ||
| * | ||
| * @return the trace file | ||
| * @throws IOException if the file cannot be written | ||
| */ | ||
| private static Path writeTrace() throws IOException { | ||
| StringBuilder sb = new StringBuilder(); | ||
| for (int nonce = 1; nonce <= NUM_INVOCATIONS; nonce++) { | ||
| for (String kind : new String[] {"ENTER", "EXIT1"}) { | ||
| sb.append("foo.Bar.baz():::") | ||
| .append(kind) | ||
| .append("\nthis_invocation_nonce\n") | ||
| .append(nonce) | ||
| .append("\nx\n") | ||
| .append(nonce) | ||
| .append("\n1\n\n"); | ||
| } | ||
| } | ||
| Path trace = Files.createTempFile("TraceSelectTest", ".dtrace"); | ||
| Files.writeString(trace, sb, UTF_8); | ||
| return trace; | ||
| } | ||
|
|
||
| /** Tests that sampling twice with the same seed selects the same invocations. */ | ||
| @Test | ||
| public void testSameSeedSameSample() throws IOException { | ||
| Path trace = writeTrace(); | ||
| try { | ||
| int sampleSize = 5; | ||
| List<String> sample1 = | ||
| TraceSelect.selectSample(trace.toString(), sampleSize, new Random(1000), false); | ||
| List<String> sample2 = | ||
| TraceSelect.selectSample(trace.toString(), sampleSize, new Random(1000), false); | ||
| // The sample is a proper subset of the invocations, so the test is not vacuous. | ||
| assertEquals(sampleSize, sample1.size()); | ||
| assertEquals(sample1, sample2); | ||
| } finally { | ||
| Files.delete(trace); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.