Skip to content

Commit

Permalink
Merge pull request #31 from rbonifacio/task/merge_changes_for_cycle_t…
Browse files Browse the repository at this point in the history
…imes

Changes for 1st to 5th methodology cycles
  • Loading branch information
Jclavo authored Nov 20, 2024
2 parents 702c06a + e63c9d6 commit 8c1eff4
Show file tree
Hide file tree
Showing 13 changed files with 634 additions and 71 deletions.
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,24 @@ This project use some of the [FlowDroid](https://github.com/secure-software-engi

### Flowdroid Benchmark

> failed: 0, passed: 64, ignored: 39 of 103 test (62.14%)
> failed: 0, passed: 73, ignored: 30 of 103 test (70.87%)
- **AliasingTest** - failed: 0, passed: 5, ignored: 1 of 6 test `(83.3%)`
- [5]

- **ArraysTest** - failed: 0, passed: 1, ignored: 9 of 10 test `(10%)`
- [1]
- **ArraysTest** - failed: 0, passed: 5, ignored: 5 of 10 test `(50%)`
- [2]
- [3]
- [4]
- [6]
- [7]
- [5]
- [8]
- [9]
- [10]

- **BasicTest** - failed: 0, passed: 38, ignored: 4 of 42 test `(90.48%)`
- [17]
- **BasicTest** - failed: 0, passed: 39, ignored: 3 of 42 test `(92.85%)`
- [36]
- [38]
- [42]

- **CollectionTest** - failed: 0, passed: 1, ignored: 13 of 14 test `(7.14%)`
- [2]
- **CollectionTest** - failed: 0, passed: 3, ignored: 11 of 14 test `(21.42%)`
- [3]
- [4]
- [5]
Expand All @@ -97,19 +91,15 @@ This project use some of the [FlowDroid](https://github.com/secure-software-engi
- [11b]
- [12]
- [13]
- [14]

- **DataStructureTest** - failed: 0, passed: 5, ignored: 1 of 6 test `(83.3%)`
- [2]
- **DataStructureTest** - failed: 0, passed: 5, ignored: 1 of 6 test `(83.33%)`
- [5]

- **FactoryTest** - failed: 0, passed: 2, ignored: 1 of 3 test `(66.67%)`
- [3]

- **InterTest** - failed: 0, passed: 8, ignored: 6 of 14 test `(57.14%)`
- [4]
- [5]
- **InterTest** - failed: 0, passed:11, ignored: 4 of 14 test `(78.57%)`
- [6]
- [7]
- [11] - flaky
- [12]

Expand All @@ -118,7 +108,8 @@ This project use some of the [FlowDroid](https://github.com/secure-software-engi
- [2]
- [3]

- **StrongUpdateTest** - failed: 0, passed: 4, ignored: 1 of 5 test `(80%)`
- [4]
- **StrongUpdateTest** - failed: 0, passed: 3, ignored: 2 of 5 test `(60%)`
- [3]
- [5]


29 changes: 24 additions & 5 deletions src/main/scala/br/unb/cic/soot/graph/Graph.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ case class StringLabel(label: String) extends EdgeLabel {
override val labelType: LabelType = SimpleLabel
}

case class ContextSensitiveRegion(statement: Statement, calleeMethod: String)
case class ContextSensitiveRegion(statement: Statement, calleeMethod: String, context: Set[String])

case class CallSiteLabel(csRegion: ContextSensitiveRegion, labelType: CallSiteLabelType) extends EdgeLabel {
override type T = ContextSensitiveRegion
Expand Down Expand Up @@ -411,6 +411,11 @@ class Graph() {
}
})

// check if there path has only one context
if (! isValidContext(csOpen, csClose)) {
return false
}

// Get all the cs) without a (cs
val unopenedCS = getUnmatchedCallSites(csClose, csOpen)
// Get all the cs) without a (cs
Expand All @@ -429,6 +434,20 @@ class Graph() {
return validCS
}

def isValidContext(csOpen: List[CallSiteLabel], csClose: List[CallSiteLabel]): Boolean = {
var cs: Set[String] = Set()

val csOpenAndClose = csOpen ++ csClose

csOpenAndClose.foreach(open => {
if (open.value.context.nonEmpty) {
cs = cs + open.value.context.head
}
})

cs.size <= 1
}

def nodes(): scala.collection.Set[GraphNode] = graph.nodes.map(node => node.toOuter).toSet

def edges(): scala.collection.Set[GraphEdge] = graph.edges.map(edge => {
Expand Down Expand Up @@ -498,10 +517,10 @@ class Graph() {
var l = e.label
val label: String = e.label match {
case c: CallSiteLabel => {
// if (c.labelType == CallSiteOpenLabel) { "[label=\"cs(\"]" }
// else { "[label=\"cs)\"]" }
if (c.labelType == CallSiteOpenLabel) { "[label=\"cs(:" + c.value.statement.stmt + "\"]" }
else { "[label=\"cs):" + c.value.statement.stmt + "\"]" }
if (c.labelType == CallSiteOpenLabel) { s"""[label="CS([${ if (c.value.context.nonEmpty) c.value.context.head }]"]""" }
else { s"""[label="CS)[${ if (c.value.context.nonEmpty) c.value.context.head }]"]""" }
// if (c.labelType == CallSiteOpenLabel) { s"""[label="CS(${c.value.statement.stmt} [${c.value.context.head}]"]""" }
// else { s"""[label="CS)${c.value.statement.stmt} [${c.value.context.head}]"]""" }
}
case c: TrueLabelType =>{ "[penwidth=3][label=\"T\"]" }
case c: FalseLabelType => { "[penwidth=3][label=\"F\"]" }
Expand Down
Loading

0 comments on commit 8c1eff4

Please sign in to comment.