forked from 5ec1cff/TrickyStore
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathpatch_test2.sh
More file actions
56 lines (50 loc) · 1.67 KB
/
patch_test2.sh
File metadata and controls
56 lines (50 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cat << 'INNER_EOF' > /tmp/test_patch2.txt
<<<<<<< SEARCH
@Test
fun testLocalRkpProxyValidation() {
assertTrue(
"LocalRkpProxy must validate COSE_Mac0 structure (0x84 header check)",
localRkpProxyContent.contains("validateMacedPublicKey") &&
localRkpProxyContent.contains("0x84")
)
}
=======
@Test
fun testLocalRkpProxyValidation() {
assertTrue(
"LocalRkpProxy must validate COSE_Mac0 structure",
localRkpProxyContent.contains("validateMacedPublicKey")
)
}
>>>>>>> REPLACE
INNER_EOF
python3 -c "
import sys
import os
def apply_patch(file_path, patch_path):
try:
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
with open(patch_path, 'r', encoding='utf-8') as f:
patch = f.read()
blocks = patch.split('<<<<<<< SEARCH\n')[1:]
for block in blocks:
search, replace_and_rest = block.split('=======\n', 1)
replace = replace_and_rest.split('>>>>>>> REPLACE', 1)[0]
if search in content:
content = content.replace(search, replace, 1)
else:
print(f'Warning: Could not find block in {file_path}')
return False
with open(file_path, 'w', encoding='utf-8') as f:
f.write(content)
return True
except Exception as e:
print(f'Error applying patch: {e}')
return False
success = apply_patch('service/src/test/java/cleveres/tricky/cleverestech/KeyAttestationVerificationTest.kt', '/tmp/test_patch2.txt')
if success:
print('Patch applied successfully to test')
else:
sys.exit(1)
"