Skip to content

Commit 950a865

Browse files
Deprecate delete onExitTest in test fixtures (#5764)
* Deprecate delete on exit c2cpg * Deprecate deleteOnExit in Test Fixtures * Removed unused variable in CSharpCode2CpgFixture * Format
1 parent 71efc54 commit 950a865

File tree

9 files changed

+5
-28
lines changed

9 files changed

+5
-28
lines changed

joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/testfixtures/AstC2CpgFrontend.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ trait AstC2CpgFrontend extends LanguageFrontend {
1818
override type ConfigType = Config
1919

2020
def execute(sourceCodePath: java.io.File): Cpg = {
21-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
22-
FileUtil.deleteOnExit(cpgOutFile)
23-
val cpg = newEmptyCpg(Option(cpgOutFile.toString))
21+
val cpg = newEmptyCpg()
2422
val pathAsString = sourceCodePath.getAbsolutePath
2523
val config = getConfig()
2624
.fold(Config())(_.asInstanceOf[Config])
2725
.withInputPath(pathAsString)
28-
.withOutputPath(pathAsString)
2926
.withSchemaValidation(ValidationMode.Enabled)
3027
val global = new CGlobal()
3128

joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/testfixtures/C2CpgFrontend.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ trait C2CpgFrontend extends LanguageFrontend {
1111
override type ConfigType = Config
1212

1313
def execute(sourceCodePath: java.io.File): Cpg = {
14-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
15-
FileUtil.deleteOnExit(cpgOutFile)
1614
val c2cpg = new C2Cpg()
1715
val config = getConfig()
1816
.fold(Config())(_.asInstanceOf[Config])
1917
.withInputPath(sourceCodePath.getAbsolutePath)
20-
.withOutputPath(cpgOutFile.toString)
2118
val res = c2cpg.createCpg(config).get
2219
new PostFrontendValidator(res, false).run()
2320
res

joern-cli/frontends/csharpsrc2cpg/src/test/scala/io/joern/csharpsrc2cpg/testfixtures/CSharpCode2CpgFixture.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ trait CSharpFrontend extends LanguageFrontend {
8585
.getOrElse(Config().withSchemaValidation(ValidationMode.Enabled))
8686

8787
override def execute(sourceCodeFile: File): Cpg = {
88-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
89-
FileUtil.deleteOnExit(cpgOutFile)
90-
val config = defaultConfig.withInputPath(sourceCodeFile.getAbsolutePath).withOutputPath(cpgOutFile.toString)
88+
val config = defaultConfig.withInputPath(sourceCodeFile.getAbsolutePath)
9189
val tmp = new CSharpSrc2Cpg().createCpg(config).get
9290
new PostFrontendValidator(tmp, false).createAndApply()
9391
tmp

joern-cli/frontends/gosrc2cpg/src/test/scala/io/joern/go2cpg/testfixtures/GoCodeToCpgSuite.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@ class DefaultTestCpgWithGo(val fileSuffix: String) extends DefaultTestCpg with S
3535
}
3636

3737
def execute(sourceCodePath: java.io.File): Cpg = {
38-
val cpgOutFile = FileUtil.newTemporaryFile("go2cpg.bin")
39-
FileUtil.deleteOnExit(cpgOutFile)
4038
goSrc2Cpg = Some(new GoSrc2Cpg(this.goGlobal))
4139
val config = getConfig()
4240
.collectFirst { case x: Config => x }
4341
.getOrElse(Config())
4442
.withInputPath(sourceCodePath.getAbsolutePath)
45-
.withOutputPath(cpgOutFile.toString)
4643
val res = goSrc2Cpg.get.createCpg(config).get
4744
new PostFrontendValidator(res, false).run()
4845
res

joern-cli/frontends/jssrc2cpg/src/test/scala/io/joern/jssrc2cpg/testfixtures/AstJsSrc2CpgFrontend.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ trait AstJsSrc2CpgFrontend extends LanguageFrontend {
1717
override type ConfigType = Config
1818

1919
def execute(sourceCodePath: java.io.File): Cpg = {
20-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
21-
FileUtil.deleteOnExit(cpgOutFile)
22-
val cpg = newEmptyCpg(Option(cpgOutFile.toString))
20+
val cpg = newEmptyCpg()
2321
val pathAsString = sourceCodePath.getAbsolutePath
2422
val config = getConfig()
2523
.fold(Config())(_.asInstanceOf[Config])
2624
.withInputPath(pathAsString)
27-
.withOutputPath(pathAsString)
2825
val hash = HashUtil.sha256(pathAsString)
2926

3027
new JavaScriptMetaDataPass(cpg, hash, pathAsString).createAndApply()

joern-cli/frontends/pysrc2cpg/src/test/scala/io/joern/pysrc2cpg/testfixtures/Py2CpgTestContext.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ class Py2CpgTestContext {
4747

4848
def buildCpg: Cpg = {
4949
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
50-
FileUtil.deleteOnExit(cpgOutFile)
5150
val config = Py2CpgOnFileSystemConfig()
5251
.withInputPath(absTestFilePath)
53-
.withOutputPath(cpgOutFile.toString)
5452
.withSchemaValidation(ValidationMode.Enabled)
5553
.withDisableFileContent(!enableFileContent)
5654
if (buildResult.isEmpty) {

joern-cli/frontends/swiftsrc2cpg/src/test/scala/io/joern/swiftsrc2cpg/testfixtures/AstSwiftSrc2CpgFrontend.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ trait AstSwiftSrc2CpgFrontend extends LanguageFrontend {
1717
final override type ConfigType = Config
1818

1919
def execute(sourceCodePath: java.io.File): Cpg = {
20-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
21-
FileUtil.deleteOnExit(cpgOutFile)
22-
val cpg = newEmptyCpg(Option(cpgOutFile.toString))
20+
val cpg = newEmptyCpg()
2321
val pathAsString = sourceCodePath.getAbsolutePath
2422
var config = Config()
2523
.withInputPath(pathAsString)
26-
.withOutputPath(cpgOutFile.toString)
2724
getConfig().foreach(c => config = config.withDefines(c.defines))
2825
val astGenResult = new AstGenRunner(config).execute(Paths.get(pathAsString))
2926
val astCreationPass = new AstCreationPass(cpg, astGenResult, config)(ValidationMode.Enabled)

joern-cli/frontends/swiftsrc2cpg/src/test/scala/io/joern/swiftsrc2cpg/testfixtures/SwiftCompilerSrc2CpgFrontend.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ trait SwiftCompilerSrc2CpgFrontend extends LanguageFrontend {
1010
final override type ConfigType = Config
1111

1212
def execute(sourceCodePath: java.io.File): Cpg = {
13-
val cpgOutFile = FileUtil.newTemporaryFile(suffix = "cpg.bin")
14-
FileUtil.deleteOnExit(cpgOutFile)
15-
1613
val pathAsString = sourceCodePath.toPath.resolve("SwiftTest").toAbsolutePath.toString
1714
var config = Config()
1815
.withInputPath(pathAsString)
19-
.withOutputPath(cpgOutFile.toString)
2016
getConfig().foreach(c => config = config.withDefines(c.defines).withSwiftBuild(c.swiftBuild))
2117

2218
val cpg = new SwiftSrc2Cpg().createCpg(config).get

joern-cli/frontends/x2cpg/src/main/scala/io/joern/x2cpg/X2Cpg.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import scala.util.matching.Regex
1717
import scala.util.{Failure, Success, Try}
1818

1919
object X2CpgConfig {
20-
def defaultOutputPath: String = "cpg.bin"
20+
def defaultOutputPath: String = ""
2121

2222
final case class GenericConfig(
2323
inputPath: String = "",

0 commit comments

Comments
 (0)