1#!/usr/bin/env python3 2# 3# Arm SCP/MCP Software 4# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. 5# 6# SPDX-License-Identifier: BSD-3-Clause 7 8""" 9Build and check unit tests for modules. 10This script runs "CC=gcc make -f Makefile.cmake mod_test" and performs all 11modules' unit tests. 12""" 13 14import sys 15import subprocess 16 17 18def banner(text): 19 columns = 80 20 title = " {} ".format(text) 21 print("\n\n{}".format(title.center(columns, "*"))) 22 23 24def main(): 25 banner("Build and run modules' unit tests") 26 27 result = subprocess.Popen( 28 "CC=gcc make -f Makefile.cmake mod_test", 29 shell=True, 30 stdout=subprocess.PIPE, 31 stderr=subprocess.PIPE) 32 33 (stdout, stderr) = result.communicate() 34 35 print(stdout.decode()) 36 37 if stderr: 38 print(stderr.decode()) 39 return 1 40 41 return 0 42 43 44if __name__ == '__main__': 45 sys.exit(main()) 46