FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/func/python/state_test_write.py at main · faasm/python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
faasm
/
python
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
6
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
func
/
python
/
state_test_write.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
56 lines (44 loc) · 1.24 KB
Breadcrumbs
python
/
func
/
python
/
state_test_write.py
Copy path
File metadata and controls
56 lines (44 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
from
pyfaasm
.
core
import
(
read_state
,
read_state_offset
,
write_state_offset
,
push_state
,
pull_state
,
push_state_partial
,
write_state
,
)
key
=
"pyStateTest"
value_len
=
10
full_value
=
b"0123456789"
segment
=
b"999"
offset
=
2
segment_len
=
3
modified_value
=
b"0199956789"
def
_check_full_value
(
expected
):
pull_state
(
key
,
value_len
)
actual
=
read_state
(
key
,
value_len
)
if
actual
!=
expected
:
msg
=
"Mismatch: actual {}, expected {})"
.
format
(
actual
,
expected
)
print
(
msg
)
exit
(
1
)
def
faasm_main
():
# Set the full value initially
write_state
(
key
,
full_value
)
push_state
(
key
)
# Check the full value has been written
_check_full_value
(
full_value
)
# Update a segment
write_state_offset
(
key
,
value_len
,
offset
,
segment
)
push_state_partial
(
key
)
# Check the full value again
_check_full_value
(
modified_value
)
# Check just the segment
actual_segment
=
read_state_offset
(
key
,
value_len
,
offset
,
segment_len
)
if
actual_segment
!=
segment
:
msg
=
"Mismatched segment: actual {}, expected {}"
.
format
(
actual_segment
,
segment
)
print
(
msg
)
exit
(
1
)
print
(
"Successful Python state writing check"
)
return
0
Back
|
FazBrowse Home
|
New Git URL