[tests/aots] move the update script to update.py

This commit is contained in:
Ebrahim Byagowi 2020-05-31 12:57:26 +04:30
parent b318229993
commit bb719915d9
2 changed files with 30 additions and 17 deletions

View File

@ -9,29 +9,13 @@ lib:
EXTRA_DIST = \
COPYING \
fonts \
update.py \
$(TESTS) \
$(NULL)
TEST_EXTENSIONS = .tests
TESTS_LOG_COMPILER = $(srcdir)/../../run-tests.py $(top_builddir)/util/hb-shape$(EXEEXT)
init-aots:
git clone https://github.com/adobe-type-tools/aots $(srcdir)/aots
make -C$(srcdir)/aots
make -C$(srcdir)/aots/harfbuzz
touch $(srcdir)/init-aots
update-tests: init-aots lib
cp $(srcdir)/hb-aots-tester.cpp $(srcdir)/aots/harfbuzz/hb-aots-tester.cpp
$(CXX) -Wno-narrowing $(srcdir)/aots/harfbuzz/hb-aots-tester.cpp \
-I$(top_srcdir)/src/ -o $(srcdir)/aots/harfbuzz/aots \
-L$(top_builddir)/src/.libs -lharfbuzz
rm -rf $(srcdir)/tests/
mkdir $(srcdir)/tests/
export LD_LIBRARY_PATH=$(realpath $(top_builddir)/src/.libs); cd $(srcdir)/aots/harfbuzz; ./aots
.PHONY: update-tests
include Makefile.sources
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import sys, os, subprocess, shutil
os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__)))
git = shutil.which ('git'); assert git
make = shutil.which ('make'); assert make
java = shutil.which ('java'); assert java
gcc = shutil.which ('gcc'); assert gcc
pull = False
if not os.path.exists ('aots'):
subprocess.run ([git, 'clone', 'https://github.com/adobe-type-tools/aots'], check=True)
pull = True
if pull or 'pull' in sys.argv:
subprocess.run ([git, 'pull'], cwd='aots', check=True)
subprocess.run ([make, '-C', 'aots'], check=True)
subprocess.run ([make, '-C', 'aots/harfbuzz'], check=True)
shutil.copy ('hb-aots-tester.cpp', 'aots/harfbuzz')
# TODO: remove *nix assumptions
subprocess.run ([gcc, '-Wno-narrowing', 'aots/harfbuzz/hb-aots-tester.cpp',
'../../../../src/harfbuzz.cc', '-DHB_NO_MT', '-fno-exceptions', '-lm',
'-I../../../../src', '-o', 'aots/harfbuzz/aots'], check=True)
shutil.rmtree ('tests')
os.mkdir ('tests')
subprocess.run (['./aots'], cwd='aots/harfbuzz', check=True)