aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm/test_bfrfs.py
blob: ae12fa8edd6b495b854be28c6425adbf37e3ac9e (plain)
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
#!/usr/bin/env python3
#
# Copyright 2017 Ettus Research, National Instruments Company
#
# SPDX-License-Identifier: GPL-3.0
#
import mpmlog
import bfrfs

LOG = mpmlog.get_main_logger().getChild('log')
B0 = bfrfs.BufferFS(b'', 256, 16, log=LOG)

B0.set_blob('foo', b'123123123')
B0.set_blob('baz', b'abcdabcdasdfasdf')

print(B0.buffer)
print(len(B0.buffer))

LOG.warn('next foo')


new_buf = open('eeprom.dat', 'rb').read()
B1 = bfrfs.BufferFS(new_buf, 256, 16, log=LOG)
print(B1.get_blob('foo'))
print(B1.get_blob('baz'))
LOG.warn('next foo')
B1.set_blob('baz', b'asdfalskdfjalksdfasdfkasdfkjh')
B1.set_blob('foo', b'asdfalskdfjalksdfasdfkasdfkjh2')
open('eeprom.dat', 'wb').write(B1.buffer)

print(B1.get_blob('foo'))