Skip to content

Commit

Permalink
Added test cases for testing edge cases for .NET binaries (#90)
Browse files Browse the repository at this point in the history
Co-authored-by: Ladislav Zezula <ladislav.zezula@avast.com>
  • Loading branch information
ladislav-zezula and Ladislav Zezula authored Jul 20, 2021
1 parent 39d1bb8 commit 5ed8137
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions tools/fileinfo/bugs/dot-net-edge-cases/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from regression_tests import *

class DotNetEdgeCaseTest1(Test):
settings = TestSettings(
tool='fileinfo',
args='--json --verbose',
input=['DotNetSample32.exe_', 'DotNetSample32_NoDataDir.exe_']
)

def test_is_dotnet(self):
assert self.fileinfo.succeeded
self.assertEqual(self.fileinfo.output['fileFormat'], 'PE')
self.assertEqual(self.fileinfo.output['languages'][0]['name'], 'CIL/.NET')
self.assertTrue(self.fileinfo.output['languages'][0]['bytecode'])
self.assertEqual(self.fileinfo.output['dotnetInfo']['runtimeVersion'], '2.5')
self.assertEqual(self.fileinfo.output['dotnetInfo']['moduleVersionId'], 'e843efa5-5493-4098-8cd4-aa9a386da08e')
self.assertEqual(self.fileinfo.output['dotnetInfo']['classes'][0]['fullyQualifiedName'], 'TestNetAppForms.Program')

class DotNetEdgeCaseTest2(Test):
settings = TestSettings(
tool='fileinfo',
args='--json --verbose',
input=['TestDotNetInResources32.exe_', 'TestDotNetInResources64.exe_']
)

def test_is_not_dotnet(self):
assert self.fileinfo.succeeded
self.assertEqual(self.fileinfo.output['fileFormat'], 'PE')
self.assertFalse('languages' in self.fileinfo.output)
self.assertFalse('dotnetInfo' in self.fileinfo.output)

Binary file not shown.

0 comments on commit 5ed8137

Please sign in to comment.