Skip to content

Commit d9b7e5d

Browse files
Test symbols plugins and avoid click versions
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
1 parent 2e6dc55 commit d9b7e5d

File tree

4 files changed

+277
-0
lines changed

4 files changed

+277
-0
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ setup_requires = setuptools_scm[toml] >= 4
4242
python_requires = >=3.9
4343

4444
install_requires =
45+
click<8.2
4546
commoncode
4647
plugincode
4748
typecode
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"files": [
3+
{
4+
"path": "Lumen",
5+
"type": "file",
6+
"macho_symbols": [
7+
"Block",
8+
"CC",
9+
"CFConstantStringClassReference",
10+
"CFDataGetBytePtr",
11+
"CFRelease",
12+
"CGDataProviderCopyData",
13+
"CGDisplayCreateImage",
14+
"CGImageGetDataProvider",
15+
"CGImageGetHeight",
16+
"CGImageGetWidth",
17+
"CGMainDisplayID",
18+
"IODisplayGetFloatParameter",
19+
"IODisplaySetFloatParameter",
20+
"IOIteratorNext",
21+
"IOObjectRelease",
22+
"IORegistryEntryCreateCFProperty",
23+
"IOServiceGetMatchingService",
24+
"IOServiceGetMatchingServices",
25+
"IOServiceMatching",
26+
"METACLASS",
27+
"NSApp",
28+
"NSApplicationMain",
29+
"NSArray",
30+
"NSBundle",
31+
"NSConcreteGlobalBlock",
32+
"NSConcreteStackBlock",
33+
"NSDictionary",
34+
"NSFileManager",
35+
"NSImage",
36+
"NSJSONSerialization",
37+
"NSMutableArray",
38+
"NSMutableData",
39+
"NSMutableDictionary",
40+
"NSMutableIndexSet",
41+
"NSMutableString",
42+
"NSMutableURLRequest",
43+
"NSNotificationCenter",
44+
"NSNumber",
45+
"NSObject",
46+
"NSOpenPanel",
47+
"NSStatusBar",
48+
"NSString",
49+
"NSTableCellView",
50+
"NSTimer",
51+
"NSURL",
52+
"NSURLSession",
53+
"NSURLSessionConfiguration",
54+
"NSUserDefaults",
55+
"NSWindowController",
56+
"NSWorkspace",
57+
"assign",
58+
"autoreleaseReturnValue",
59+
"binder",
60+
"destroyWeak",
61+
"dispatch",
62+
"dispose",
63+
"dyld",
64+
"enumerationMutation",
65+
"fail",
66+
"guard",
67+
"header",
68+
"kCFAllocatorDefault",
69+
"kIOMasterPortDefault",
70+
"loadWeakRetained",
71+
"main",
72+
"mh",
73+
"msgSend",
74+
"msgSendSuper2",
75+
"object",
76+
"pow",
77+
"release",
78+
"retain",
79+
"retainAutorelease",
80+
"retainAutoreleaseReturnValue",
81+
"retainAutoreleasedReturnValue",
82+
"sleep",
83+
"stack",
84+
"storeStrong",
85+
"storeWeak",
86+
"stub"
87+
],
88+
"scan_errors": []
89+
}
90+
]
91+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"files": [
3+
{
4+
"path": "TranslucentTB-setup.exe",
5+
"type": "file",
6+
"winpe_symbols": [
7+
"AdjustTokenPrivileges",
8+
"CallWindowProcW",
9+
"CharLowerBuffW",
10+
"CharNextW",
11+
"CharUpperBuffW",
12+
"CharUpperW",
13+
"CloseHandle",
14+
"CompareStringW",
15+
"CreateDirectoryW",
16+
"CreateEventW",
17+
"CreateFileW",
18+
"CreateProcessW",
19+
"CreateThread",
20+
"CreateWindowExW",
21+
"DeleteCriticalSection",
22+
"DeleteFileW",
23+
"DestroyWindow",
24+
"DispatchMessageW",
25+
"EnterCriticalSection",
26+
"EnumCalendarInfoW",
27+
"ExitProcess",
28+
"ExitThread",
29+
"ExitWindowsEx",
30+
"FindClose",
31+
"FindFirstFileW",
32+
"FindResourceW",
33+
"FormatMessageW",
34+
"FreeLibrary",
35+
"GetACP",
36+
"GetCPInfo",
37+
"GetCPInfoExW",
38+
"GetCommandLineW",
39+
"GetCurrentProcess",
40+
"GetCurrentThread",
41+
"GetCurrentThreadId",
42+
"GetDateFormatW",
43+
"GetDiskFreeSpaceW",
44+
"GetEnvironmentVariableW",
45+
"GetExitCodeProcess",
46+
"GetExitCodeThread",
47+
"GetFileAttributesW",
48+
"GetFileSize",
49+
"GetFileVersionInfoSizeW",
50+
"GetFileVersionInfoW",
51+
"GetFullPathNameW",
52+
"GetLastError",
53+
"GetLocalTime",
54+
"GetLocaleInfoW",
55+
"GetModuleFileNameW",
56+
"GetModuleHandleW",
57+
"GetProcAddress",
58+
"GetStartupInfoW",
59+
"GetStdHandle",
60+
"GetSystemDefaultUILanguage",
61+
"GetSystemDirectoryW",
62+
"GetSystemInfo",
63+
"GetSystemMetrics",
64+
"GetThreadLocale",
65+
"GetThreadPriority",
66+
"GetTickCount",
67+
"GetUserDefaultLangID",
68+
"GetUserDefaultUILanguage",
69+
"GetVersion",
70+
"GetVersionExW",
71+
"GetWindowsDirectoryW",
72+
"HeapAlloc",
73+
"HeapCreate",
74+
"HeapDestroy",
75+
"HeapFree",
76+
"InitCommonControls",
77+
"InitializeCriticalSection",
78+
"IsValidLocale",
79+
"LeaveCriticalSection",
80+
"LoadLibraryA",
81+
"LoadLibraryExW",
82+
"LoadLibraryW",
83+
"LoadResource",
84+
"LoadStringW",
85+
"LocalAlloc",
86+
"LocalFree",
87+
"LockResource",
88+
"LookupPrivilegeValueW",
89+
"MessageBoxW",
90+
"MsgWaitForMultipleObjects",
91+
"MultiByteToWideChar",
92+
"NetApiBufferFree",
93+
"NetWkstaGetInfo",
94+
"OpenProcessToken",
95+
"PeekMessageW",
96+
"QueryPerformanceCounter",
97+
"RaiseException",
98+
"ReadFile",
99+
"RegCloseKey",
100+
"RegOpenKeyExW",
101+
"RegQueryValueExW",
102+
"RemoveDirectoryW",
103+
"ResetEvent",
104+
"ResumeThread",
105+
"RtlUnwind",
106+
"SafeArrayCreate",
107+
"SafeArrayGetLBound",
108+
"SafeArrayGetUBound",
109+
"SafeArrayPtrOfIndex",
110+
"SetEndOfFile",
111+
"SetErrorMode",
112+
"SetEvent",
113+
"SetFilePointer",
114+
"SetLastError",
115+
"SetThreadLocale",
116+
"SetThreadPriority",
117+
"SetWindowLongW",
118+
"SizeofResource",
119+
"Sleep",
120+
"SuspendThread",
121+
"SwitchToThread",
122+
"SysAllocStringLen",
123+
"SysFreeString",
124+
"SysReAllocStringLen",
125+
"TlsGetValue",
126+
"TlsSetValue",
127+
"TranslateMessage",
128+
"UnhandledExceptionFilter",
129+
"VariantChangeType",
130+
"VariantClear",
131+
"VariantCopy",
132+
"VariantInit",
133+
"VerQueryValueW",
134+
"VerSetConditionMask",
135+
"VerifyVersionInfoW",
136+
"VirtualAlloc",
137+
"VirtualFree",
138+
"VirtualProtect",
139+
"VirtualQuery",
140+
"VirtualQueryEx",
141+
"WaitForSingleObject",
142+
"WideCharToMultiByte",
143+
"WriteFile",
144+
"lstrlenW"
145+
],
146+
"scan_errors": []
147+
}
148+
]
149+
}

tests/test_plugin.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (c) nexB Inc. and others. All rights reserved.
4+
# ScanCode is a trademark of nexB Inc.
5+
# SPDX-License-Identifier: Apache-2.0
6+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
7+
# See https://github.com/nexB/binary-inspector for support or download.
8+
# See https://aboutcode.org for more information about nexB OSS projects.
9+
#
10+
11+
import os
12+
13+
from commoncode.testcase import FileDrivenTesting
14+
from scancode.cli_test_utils import check_json_scan
15+
from scancode.cli_test_utils import run_scan_click
16+
from scancode_config import REGEN_TEST_FIXTURES
17+
18+
test_env = FileDrivenTesting()
19+
test_env.test_data_dir = os.path.join(os.path.dirname(__file__), "data")
20+
21+
22+
def test_scancode_plugin_with_winpe_symbol_option():
23+
test_file = test_env.get_test_loc("winpe/TranslucentTB-setup.exe")
24+
result_file = test_env.get_temp_file("json")
25+
args = ["--winpe-symbol", test_file, "--json", result_file]
26+
run_scan_click(args)
27+
expected = test_env.get_test_loc("winpe/TranslucentTB-symbols-plugin.json")
28+
check_json_scan(expected, result_file, regen=True)
29+
30+
def test_scancode_plugin_with_macho_symbol_option():
31+
test_file = test_env.get_test_loc("macho/Lumen")
32+
result_file = test_env.get_temp_file("json")
33+
args = ["--macho-symbol", test_file, "--json", result_file]
34+
run_scan_click(args)
35+
expected = test_env.get_test_loc("macho/Lumen-symbols-plugin.json")
36+
check_json_scan(expected, result_file, regen=True)

0 commit comments

Comments
 (0)