Make test scripts be compatible with python3

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2023-04-21 09:49:16 +09:00 committed by Boram Bae
commit 8f5311010e
3 changed files with 7 additions and 12 deletions

View file

@ -16,9 +16,6 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '2.7'
- name: Install Packages
run: |
sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ focal main universe"

View file

@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import os
import subprocess
import sys
@ -69,7 +67,7 @@ def check_tidy(src_dir, update, clang_format, stats):
formatted = subprocess.check_output([clang_format, '-style=file', file])
if update:
with open(file, 'w') as f:
with open(file, 'wb') as f:
f.write(formatted)
stats.files += 1
@ -90,7 +88,7 @@ def check_tidy(src_dir, update, clang_format, stats):
if not line.strip():
stats.empty_lines += 1
diff = list(unified_diff(original, formatted.splitlines(True)))
diff = list(unified_diff(original, formatted.decode('utf-8').splitlines(True)))
if diff:
report_error('format error')
for diffline in diff:

View file

@ -71,16 +71,16 @@ def run_all_test262(engine, arch):
if not out:
raise Exception('test262 run with empty exclude list returns no result')
return out
return out.decode('utf-8')
def front_template():
template_file = open(join(SCRIPT_SOURCE_DIR, 'template.xml'), 'r')
template = template_file.read()
template = str(template_file.read())
template_file.close()
return template
def rear_template():
return '</excludeList>'
return str('</excludeList>')
def main():
parser = ArgumentParser()
@ -128,8 +128,8 @@ def main():
out_file.write(item)
out_file.write(rear_template())
numstat = subprocess.check_output(["git", "diff", "--numstat", DEFAULT_EXCLUDE_LIST]).split("\t")
lines = sorted(re.findall(r'^[+|-][^+|-].*', subprocess.check_output(["git", "diff", "--unified=0", DEFAULT_EXCLUDE_LIST]), re.MULTILINE), key=lambda x:x[:1])
numstat = subprocess.check_output(["git", "diff", "--numstat", DEFAULT_EXCLUDE_LIST]).decode('utf-8').split("\t")
lines = sorted(re.findall(r'^[+|-][^+|-].*', subprocess.check_output(["git", "diff", "--unified=0", DEFAULT_EXCLUDE_LIST]).decode('utf-8'), re.MULTILINE), key=lambda x:x[:1])
for i in lines:
if i[0] == "+":