Skip to content

[EXPERIMENTAL] Syntactic and Semantic Mutations #3

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

Draft
wants to merge 114 commits into
base: constraint-mutations
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
83a29aa
SyntacticMutation model
FedeLoch Sep 24, 2024
d5c431e
Fixing inject into performace problem
FedeLoch Sep 24, 2024
9893db1
RAPathMutatorTest class
FedeLoch Sep 25, 2024
52f93b5
Empty test cases to complete
FedeLoch Sep 25, 2024
fcac41b
Fixing wrong predecnce and replacing method call to use the mutations…
FedeLoch Sep 25, 2024
d479544
Forcing tests to fail
FedeLoch Sep 26, 2024
700a5c9
Fixing primiteTest
FedeLoch Sep 27, 2024
9905cb4
Creating RAPrimitiveAutoTest solutionsFor
FedeLoch Sep 30, 2024
2ee2696
Fixing primitive cases
FedeLoch Oct 1, 2024
f3696ec
ToString method to faclitate the readibility on solutions and compare…
FedeLoch Oct 1, 2024
5bb760b
Deleting unnecesary reimplementation
FedeLoch Oct 1, 2024
6596673
Tunning printing
FedeLoch Oct 1, 2024
5b1e891
CompilerCoverageCollector class
FedeLoch Oct 3, 2024
900e607
Deleting all mutations and adding some tests fto RASyntacticVarGreate…
FedeLoch Oct 6, 2024
84ed811
Testing
FedeLoch Oct 6, 2024
dc05880
Commutative constraint mutator
FedeLoch Oct 8, 2024
71f7e8f
Less than mutator
FedeLoch Oct 8, 2024
3be2d3c
Fix error
FedeLoch Oct 8, 2024
623bf71
n less than other constraint mutation
FedeLoch Oct 8, 2024
a30d454
Var(A) >= n -> ADD Var(A) = n OR Var(A) > n Mutation
FedeLoch Oct 8, 2024
3c9c486
adding RASyntacticNLessThanVarMutator to mutator
FedeLoch Oct 8, 2024
d9b1458
Fixing bug
FedeLoch Oct 8, 2024
9225ed0
Fixing error
FedeLoch Oct 8, 2024
be1cc6b
Considering bitAnd and bitOr
FedeLoch Oct 8, 2024
0715ac2
Using exploreAndMutate
FedeLoch Oct 9, 2024
159f8ed
Implementing mutation recursively, in order to generate a much richer…
FedeLoch Oct 9, 2024
04b0822
Identation
FedeLoch Oct 9, 2024
4388a7f
Tunning
FedeLoch Oct 12, 2024
015d280
Rearranging packages
FedeLoch Oct 14, 2024
44e5d47
Refactoring
FedeLoch Oct 14, 2024
d09347a
RASyntacticTypeObjectMutator
FedeLoch Oct 14, 2024
2379d63
RASyntacticVarGreaterThanIntroducingNewVarMutator
FedeLoch Oct 14, 2024
a99e111
RASyntacticIsNotIntNotEqualsRandomMutator
FedeLoch Oct 14, 2024
b036297
RASyntacticBinaryArithOpWithRandomMutator
FedeLoch Oct 15, 2024
2cace69
Testing
FedeLoch Oct 15, 2024
c5f4181
Testing
FedeLoch Oct 15, 2024
6e55f87
Quick optimization
FedeLoch Oct 16, 2024
332d1f9
Runner refactoring
FedeLoch Oct 16, 2024
a3b15d8
Refactoring
FedeLoch Oct 16, 2024
1e5f9e2
Testing coverage
FedeLoch Oct 16, 2024
0b7797b
Refactoring concolic cases to support bytecodes
FedeLoch Oct 21, 2024
3528046
Refactor on RaConcolicBytecodeCase
FedeLoch Oct 21, 2024
a4f113d
Avoiding interpret again each mutation
FedeLoch Oct 22, 2024
d8af187
Refactoring
FedeLoch Oct 23, 2024
f07501a
Fixing test and bug
FedeLoch Oct 23, 2024
16de736
Improving compiler collector
FedeLoch Oct 24, 2024
33a6757
Refactoring
FedeLoch Oct 28, 2024
f046fa6
Handling Errors from MiniZinc
FedeLoch Oct 28, 2024
be416ff
exporting node's paths
FedeLoch Nov 14, 2024
b65a39f
Add Ranger-Exploring to package list
guillep Nov 19, 2024
51afe07
Improving compiler coverage result
FedeLoch Nov 19, 2024
507e95a
Rename variables to follow Pharo convention
guillep Nov 19, 2024
428efa5
Merge 51afe07b7b2e2b06021206ff60a1afb6195c678b
guillep Nov 19, 2024
e13e299
Add vm dependency
guillep Nov 19, 2024
96546e6
Fix: Add signalerContext
guillep Nov 22, 2024
d32dd3e
little refactor
FedeLoch Nov 22, 2024
aac6d31
mutation cases
FedeLoch Nov 25, 2024
c37bcbb
extending mutator
FedeLoch Nov 25, 2024
9e0a9bc
Improvements
FedeLoch Nov 28, 2024
b8e7da5
supporting greaterThan in RAObject
FedeLoch Nov 29, 2024
06d06b2
refactoring
FedeLoch Dec 4, 2024
6cd703c
Improvements :)
FedeLoch Dec 5, 2024
c6395ae
constraint minimization
FedeLoch Dec 9, 2024
e0153d6
Removing halts
FedeLoch Dec 10, 2024
f0965f3
making minimization immutable
FedeLoch Dec 10, 2024
a4f7980
Omiting mutation on common exploration
FedeLoch Dec 10, 2024
aa382a0
indexing interpreter by architecture
FedeLoch Dec 10, 2024
0d4725f
Tunning
FedeLoch Dec 11, 2024
4c61da8
filter to reduce amount of interesting cases
FedeLoch Dec 11, 2024
9f33528
adding NeoJSON to baseLine
FedeLoch Dec 13, 2024
04a2d0c
Filtering error fixed
FedeLoch Dec 13, 2024
354159d
filtering better
FedeLoch Dec 13, 2024
915a93b
Mutant experiment
FedeLoch Dec 16, 2024
60604f9
fix on test
FedeLoch Dec 16, 2024
c482a62
commenting old logic
FedeLoch Dec 16, 2024
5f57e22
fixing bycode test error
FedeLoch Dec 16, 2024
7705b3a
Pharo extensions
FedeLoch Dec 16, 2024
7cf7997
Make caching optional
guillep Dec 16, 2024
096331f
Dumping mutations paths on file
FedeLoch Dec 16, 2024
fedfaa1
fixing tiny error
FedeLoch Dec 16, 2024
e5db71b
fix
FedeLoch Dec 16, 2024
bf10488
Tunning
FedeLoch Dec 17, 2024
106d9ad
Draft run script
guillep Dec 17, 2024
6e1e059
Making it more reusable
guillep Dec 17, 2024
fabe34a
Fixing error
FedeLoch Dec 17, 2024
9d15f3a
Merge 6e1e0599840c0da11a6b0fcb7bea9d5f79408092
FedeLoch Dec 17, 2024
ae2b155
Permissions +x
guillep Dec 17, 2024
3dba734
printing size
FedeLoch Dec 17, 2024
1bde845
Merge ae2b155350beed8f1e2f20a56058b9ad7f1b1973
FedeLoch Dec 17, 2024
50ba906
Fix bug
FedeLoch Dec 17, 2024
939c16b
indentation
guillep Dec 19, 2024
f9052fa
Sorting the code, prepare refactoring
guillep Dec 19, 2024
4e085bb
Fix path toString
FedeLoch Dec 19, 2024
9b61099
Merge f9052fafc05866ff035ab20b16f1d1b48f0153bb
FedeLoch Dec 19, 2024
0e15e63
fix printing path bug
FedeLoch Dec 19, 2024
9ac4eef
second experiment
FedeLoch Dec 19, 2024
1e8845d
Caching
guillep Dec 19, 2024
6f76c79
Merge 9ac4eef5a2957bac092bfd9a58046e81d727d841
guillep Dec 19, 2024
a912432
Add caching
guillep Dec 19, 2024
d703835
Prefix all files by type
guillep Dec 19, 2024
d08c930
Fix typo
guillep Dec 19, 2024
7ff3903
do not keep full stack trace
guillep Dec 19, 2024
a83ecd0
cleaning test after execution
guillep Dec 19, 2024
1b84247
Do not map stack traces at serialization time, already done at build …
guillep Dec 19, 2024
9ec8d18
print debug stack instead of short stack
guillep Dec 19, 2024
6c21c8a
Print the case and not the test object
guillep Dec 19, 2024
ae9e907
Fix
FedeLoch Dec 19, 2024
f3fa8c2
fix error
FedeLoch Dec 19, 2024
556b604
new experiments
FedeLoch Dec 20, 2024
aaeb0f0
change experiment's name
FedeLoch Dec 20, 2024
c4dbb37
maximumReachableCoverageWithoutMutations
FedeLoch Dec 20, 2024
2363813
Add deserializer
guillep Jan 6, 2025
acb8568
diff support
guillep Jan 6, 2025
698aac5
Bigger differ
guillep Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions BaselineOfRanger/BaselineOfRanger.class.st
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
Class {
#name : #BaselineOfRanger,
#superclass : #BaselineOf,
#category : #BaselineOfRanger
#name : 'BaselineOfRanger',
#superclass : 'BaselineOf',
#category : 'BaselineOfRanger',
#package : 'BaselineOfRanger'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfRanger >> baseline: spec [

<baseline>
spec for: #common do: [
spec
baseline: 'VMMaker'
with: [ spec repository: 'github://evref-inria/pharo-vm:ranger2' ].
spec
baseline: 'Minizinc'
with: [ spec repository: 'github://tesonep/pharo-minizinc:main' ].
spec package: 'Ranger' with: [ spec requires: #( 'Minizinc' ) ] ]
spec baseline: 'NeoJSON' with: [ spec repository: 'github://svenvc/NeoJSON/repository' ].
spec package: 'Ranger' with: [ spec requires: #( 'Minizinc' ) ].
spec package: 'Ranger-Exploring' with: [ spec requires: #( 'Ranger' ) ] ]
]
2 changes: 1 addition & 1 deletion BaselineOfRanger/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfRanger }
Package { #name : 'BaselineOfRanger' }
152 changes: 152 additions & 0 deletions Ranger-Exploring/CompilerCoverageCollector.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
Class {
#name : 'CompilerCoverageCollector',
#superclass : 'DTCoverageCollector',
#category : 'Ranger-Exploring-Collector',
#package : 'Ranger-Exploring',
#tag : 'Collector'
}

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> backendClasses [

^ { CogAbstractInstruction }, CogAbstractInstruction withAllSubclasses
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> compilerBackendCoverage: result [

^ self backendClasses inject: Dictionary new into: [ :dict :class |
dict at: (class name) put: (self coveredMethod: result from: class).
dict
]
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> compilerCoverage: result [

| dict |
dict := Dictionary new.
dict at: 'Covered nodes' put: (result nodes size).
dict at: 'Percentage of covered nodes' put: (result nodes size * 100) / result collector nodes size.
dict at: 'Frontend' put: (self compilerFrontendCoverage: result).
dict at: 'Backend' put: (self compilerBackendCoverage: result).
dict at: 'Node paths' put: (self nodePathsFrom: result).

^ dict
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> compilerFrontendCoverage: result [

^ self frontendClasses inject: Dictionary new into: [ :dict :class |
dict at: (class name) put: (self coveredMethod: result from: class).
dict
]
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> compilerMethods [

^ (
Cogit methods,
SimpleStackBasedCogit methods, "Used in the rest of Concolic tests"
StackToRegisterMappingCogit methods "Used in RAStackToRegisterMappingCogitTest"
), "Frontend" (
(CogAbstractInstruction withAllSubclasses flatCollect: #methods) difference: (
CogOutOfLineLiteralsX64Compiler methods, CogInLineLiteralsARMCompiler methods,
CogOutOfLineLiteralsARMv8Compiler methods, CogX64Compiler methods,
CogMIPSELCompiler methods, CogICacheFlushingIA32Compiler methods,
CogInLineLiteralsX64Compiler methods, CogARMv8Compiler methods
)
) "Backend"
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> coveredMethod: result from: aClass [

| totalCoveredMethods unCoveredMethods partiallyCoveredMethods unCoveredPercentage partiallyPercentage |

unCoveredMethods := result uncoveredMethods select: [ :m | m methodClass = aClass ].
partiallyCoveredMethods := result partiallyCoveredMethods select: [ :m | m methodClass = aClass ].

totalCoveredMethods := aClass methods difference: (unCoveredMethods , partiallyCoveredMethods).
unCoveredPercentage := ((unCoveredMethods size / aClass methods size) * 100) asFloat.
partiallyPercentage := ((partiallyCoveredMethods size / aClass methods size) * 100) asFloat.

^ (OrderedCollection newFromArray: {
'TotalCoveredPercentage' -> (100 - (unCoveredPercentage + partiallyPercentage)).
'UncoveredPercentage' -> unCoveredPercentage.
'PartiallyCoveredPercentage' -> partiallyPercentage.

'TotalCoveredMethods' -> (totalCoveredMethods collect: #name).
'UncoveredMethods' -> (unCoveredMethods collect: #name).
'PartiallyCoveredMethods' -> (partiallyCoveredMethods collect: #name).
}) asDictionary.
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> frontendClasses [

^ { Cogit . SimpleStackBasedCogit . StackToRegisterMappingCogit }
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> generateCompilerCoverage: result [

self generateCompilerCoverage: result at: 'CompilerCoverage.json'
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> generateCompilerCoverage: result at: fileName [

| tempDict jsonString writeStream |

tempDict := self compilerCoverage: result.

jsonString := NeoJSONWriter toStringPretty: tempDict.

writeStream := fileName asFileReference createFile writeStream.
writeStream nextPutAll: jsonString.
writeStream close
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> generateCompilerCoverage: result withFails: fails at: fileName [

| tempDict jsonString writeStream |
tempDict := self compilerCoverage: result.

tempDict at: 'Fails' put: fails.

jsonString := NeoJSONWriter toStringPretty: tempDict.

writeStream := fileName asFileReference createFile writeStream.
writeStream nextPutAll: jsonString.
writeStream close
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> measure: block [

^ CoverageCollector new methods: self compilerMethods; runOn: block
]

{ #category : 'as yet unclassified' }
CompilerCoverageCollector class >> nodePathsFrom: result [

^ result nodes inject: Dictionary new into: [ :dict :node |
| methodName path |
methodName := node methodNode compiledMethod name.
path := node path.
dict
at: methodName
ifPresent: [ (dict at: methodName) add: path ]
ifAbsentPut: [ OrderedCollection new add: path; yourself ].
dict ]
]

{ #category : 'initialization' }
CompilerCoverageCollector >> initialize [

self methods: self class compilerMethods
]
52 changes: 52 additions & 0 deletions Ranger-Exploring/CoverageCollectorBugTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Class {
#name : 'CoverageCollectorBugTest',
#superclass : 'TestCase',
#instVars : [
'collector'
],
#category : 'Ranger-Exploring-Collector',
#package : 'Ranger-Exploring',
#tag : 'Collector'
}

{ #category : 'as yet unclassified' }
CoverageCollectorBugTest >> setUp [
super setUp.

collector := CoverageCollector new.
]

{ #category : 'as yet unclassified' }
CoverageCollectorBugTest >> testCoverFirstBlockBehaviorOfAmethodWithMultipleReturnBlocks [

| target result |

target := TestClassToCover new.

collector methods: TestClassToCover methods.
result := collector runOn: [
target aMethodWithTwoReturnBlocks: true returnWithIter: 0
].

self assert: (result percentage) equals: 50.
self assert: (result partiallyCoveredMethods first) equals: TestClassToCover methods first.

]

{ #category : 'as yet unclassified' }
CoverageCollectorBugTest >> testCoverSecondBlockBehaviorOfAmethodWithMultipleReturnBlocks [

| target result statements |

target := TestClassToCover new.

collector methods: TestClassToCover methods.
result := collector runOn: [
target aMethodWithTwoReturnBlocks: false returnWithIter: 5
].

statements := TestClassToCover methods first ast body allStatements.
self assert: (result percentage) equals: 50.
self assert: (result partiallyCoveredMethods first) equals: TestClassToCover methods first.

]
18 changes: 0 additions & 18 deletions Ranger-Exploring/GreaterIntConstraintMutator.class.st

This file was deleted.

70 changes: 0 additions & 70 deletions Ranger-Exploring/GreaterIntConstraintMutatorTest.class.st

This file was deleted.

Loading