Skip to content

Instantly share code, notes, and snippets.

@dalehenrich
Created July 11, 2016 23:57
Show Gist options
  • Save dalehenrich/97f2befe07ad7bf928165a3fc64a2118 to your computer and use it in GitHub Desktop.
Save dalehenrich/97f2befe07ad7bf928165a3fc64a2118 to your computer and use it in GitHub Desktop.
[ :topez :objIn :tokens :command |
| opts args |
"for help: ./bug -h"
command
getOptsMixedLongShort:
{#('help' $h #'none').
#('boom' nil #'none').
#('clean' nil #'none').
#('create' nil #'none').
#('install' nil #'none')}
optionsAndArguments: [ :options :operands |
opts := options.
args := operands ].
opts
at: 'help'
ifAbsent: [
| analysis theColl query |
analysis := Dictionary new.
Smalltalk
at: #'SampleIndexObject'
ifAbsent: [ opts at: 'install' put: nil ].
opts
at: 'install'
ifPresent: [ :ignored |
"install supporting code here"
topez evaluateCommandString: '/home/gs/bugs/installSampleIndexObject' ].
opts
at: 'clean'
ifPresent: [ :ignored |
"clean up indexes here"
UserGlobals removeKey: #'coll' ifAbsent: [ ].
IndexManager removeAllIndexes ].
opts
at: 'create'
ifPresent: [ :ignored |
| nsc cls |
nsc := IdentityBag new.
UserGlobals at: #'coll' put: nsc.
cls := Smalltalk at: #'SampleIndexObject'.
nsc
createEqualityIndexOn: 'value1' withLastElementClass: SmallInteger;
yourself.
1 to: 500 do: [ :ignored |
1 to: 2200 do: [ :index |
| sample |
sample := cls new.
sample
value1: index;
yourself.
nsc add: sample ].
System commit ] ].
opts
at: 'boom'
ifPresent: [ :ignored |
"recreate bug here"
].
theColl := UserGlobals at: #'coll' ifAbsent: [ Set new ].
query := 'each.value1 <= 1' asQueryOn: theColl.
analysis
at: 'audit' put: theColl auditIndexes;
at: 'depMap keys' put: DependencyList depMapKeys;
at: 'depMap values' put: DependencyList depMapValues;
at: 'nsc' put: theColl;
at: 'query' put: query;
at: 'query result' put: query queryResult;
at: 'select result' put: (theColl select: [ :each | each.value1 <= 1 ]);
at: 'shared dependency lists'
put: SharedDependencyLists allEntries asArray;
yourself.
analysis ]
ifPresent: [ :ignored |
TDManPage
viewManPage:
'NAME
bug - bug sript utility template
SYNOPSIS
bug [-h|--help]
bug [--install][--clean][--create][--boom]
DESCRIPTION
Reproduce bug.
EXAMPLES
./bug --help
./bug --install
./bug --clean --create --boom; edit
'
topez: topez ] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment