[PATCH 1/2] travis-ci: provide 'addr' in file2env()

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Dec 5 07:42:19 CET 2019


Function fetch_tftp_file() in test/py/tests/test_efi_loader.py expects that
the dictionary describing a file contains an entry 'addr' specifying the
loading address.

Add an optional parameter in function file2env() to set the 'addr' entry.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 py/travis-ci/travis_tftp.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/py/travis-ci/travis_tftp.py b/py/travis-ci/travis_tftp.py
index 7289e22..4ea5c06 100644
--- a/py/travis-ci/travis_tftp.py
+++ b/py/travis-ci/travis_tftp.py
@@ -1,14 +1,28 @@
 import os
 import binascii

-def file2env(file_name):
+def file2env(file_name, addr=None):
+    """Create dictionary describing file
+
+    @filename:  name of the file to be described
+    @addr:      address used for loading the file as int (e.g. 0x40400000)
+    Return:     dictionary describing the file with entries
+                * fn    - filename
+                * size  - file size in bytes
+                * crc32 - checksum using CRC-32 algorithm
+                * addr  - loading address, optional
+    """
     file_full = os.environ['UBOOT_TRAVIS_BUILD_DIR'] + "/" + file_name

     if not os.path.isfile(file_full):
         return None

-    return {
+    ret = {
         "fn": file_name,
         "size": os.path.getsize(file_full),
         "crc32": hex(binascii.crc32(open(file_full, 'rb').read()) & 0xffffffff)[2:],
     }
+    if addr is not None:
+        ret['addr'] = addr
+
+    return ret
--
2.24.0



More information about the U-Boot mailing list