systemc: Fix and make it python 3 compatible

1. The logger behavior change breaks
commit 8deb205ea10d6cee0b58c46e097be46c784ed345
Author: Daniel Carvalho <>
Date:   Wed Mar 3 16:49:05 2021 -0300

    base: Add LOC to Loggers

    Printing the line and the file that triggered a log
    is useful for debugging.

    Change-Id: I74e0637b2943049134bd3e9a4bc6cab3766591a9
    Signed-off-by: Daniel R. Carvalho <>
    Reviewed-by: Giacomo Travaglini <>
    Maintainer: Giacomo Travaglini <>
    Tested-by: kokoro <>

2. Use bytes diff in LogChecker.
In Python3, string is required to be in a certain encoding, while in Python2,
it is not. In the testcase, misc/cae_test/general/bitwise/or/datatypes,
it contains some invalid codepoint of utf-8, we need diff the log with
bytes in Pyhton3.

3. Python3 compatible.
* dict.iteritems -> dict.items
* remove object base class
* use `except as` when catching exceptions
* handle map and filter behavior change

Test with

src/systemc/tests/ --update-json build/ARM -j `nproc` \
  --filter-file src/systemc/tests/working.filt

src/systemc/tests/ --update-json build/ARM -j `nproc` \
  --filter-file src/systemc/tests/working.filt --phase verify --result-file

Change-Id: Ibf5b99d08a948387cf6162c476c294c49a7dac0f
Reviewed-by: Gabe Black <>
Maintainer: Gabe Black <>
Tested-by: kokoro <>
1 file changed