From fb76e3d32c93c2d54af74449e7d8d8247046492c Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 3 Mar 2020 18:56:05 -0800 Subject: [PATCH 1/2] build: Remove last traces of Autotools These are some leftovers from Autotools' test harness. --- installed-tests/scripts/common.sh | 4 ++-- installed-tests/scripts/testCommandLine.sh | 4 ++-- installed-tests/scripts/testWarnings.sh | 4 ++-- test/run-test | 9 --------- 4 files changed, 6 insertions(+), 15 deletions(-) delete mode 100755 test/run-test diff --git a/installed-tests/scripts/common.sh b/installed-tests/scripts/common.sh index 7ffdb7652..8f228194c 100755 --- a/installed-tests/scripts/common.sh +++ b/installed-tests/scripts/common.sh @@ -1,9 +1,9 @@ #!/bin/sh if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then - gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console" + gjs="$TOP_BUILDDIR/gjs-console" else - gjs="$LOG_COMPILER $LOG_FLAGS gjs-console" + gjs="gjs-console" fi # Avoid interference in the profiler tests from stray environment variable diff --git a/installed-tests/scripts/testCommandLine.sh b/installed-tests/scripts/testCommandLine.sh index b50194176..1c9ab29f5 100755 --- a/installed-tests/scripts/testCommandLine.sh +++ b/installed-tests/scripts/testCommandLine.sh @@ -1,9 +1,9 @@ #!/bin/sh if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then - gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console" + gjs="$TOP_BUILDDIR/gjs-console" else - gjs="$LOG_COMPILER $LOG_FLAGS gjs-console" + gjs="gjs-console" fi # Avoid interference in the profiler tests from stray environment variable diff --git a/installed-tests/scripts/testWarnings.sh b/installed-tests/scripts/testWarnings.sh index 9cbaed849..30ca082f1 100755 --- a/installed-tests/scripts/testWarnings.sh +++ b/installed-tests/scripts/testWarnings.sh @@ -1,9 +1,9 @@ #!/bin/sh if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then - gjs="$LOG_COMPILER $LOG_FLAGS $TOP_BUILDDIR/gjs-console" + gjs="$TOP_BUILDDIR/gjs-console" else - gjs="$LOG_COMPILER $LOG_FLAGS gjs-console" + gjs="gjs-console" fi total=0 diff --git a/test/run-test b/test/run-test deleted file mode 100755 index 75f62cf68..000000000 --- a/test/run-test +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -e -# Run a GTester binary with TAP output - -if test -z "$1"; then - echo "Need a test-binary filename!" - exit 1 -fi - -$LOG_COMPILER $LOG_FLAGS "$1" --tap --keep-going --verbose -- GitLab From 8e0163a443d39f961aa7361c0bad02229d6ceedf Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 3 Mar 2020 20:50:08 -0800 Subject: [PATCH 2/2] build: Handle missing /usr/bin/locale /usr/bin/locale is shipped by glibc, so for example on musl systems it is missing. In this case, don't set the LC_ALL environment variable, and hope for the best. (This also makes the change that LC_ALL is left untouched on Windows, which seems better.) Closes: #296 --- build/choose-tests-locale.sh | 4 ++++ meson.build | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/build/choose-tests-locale.sh b/build/choose-tests-locale.sh index ded42b993..73b273b81 100755 --- a/build/choose-tests-locale.sh +++ b/build/choose-tests-locale.sh @@ -1,5 +1,9 @@ #!/bin/sh +if ! which locale > /dev/null; then + exit 1 +fi + locales=$(locale -a | xargs -n1) case $locales in diff --git a/meson.build b/meson.build index 0d8db4823..383d7e406 100644 --- a/meson.build +++ b/meson.build @@ -300,13 +300,6 @@ configure_file(output: 'config.h', configuration: header_conf) ### Check for environment ###################################################### -if cxx.get_id() == 'msvc' - tests_locale = 'C.UTF-8' -else - # Not applicable for cmd.exe shells that MSVC uses - tests_locale = run_command('build/choose-tests-locale.sh').stdout().strip() -endif - gjsjsdir = get_option('datadir') / api_name pkglibexecdir = get_option('libexecdir') / meson.project_name() abs_pkglibexecdir = get_option('prefix') / pkglibexecdir @@ -583,10 +576,18 @@ tests_environment.set('G_FILENAME_ENCODING', 'latin1') tests_environment.set('LSAN_OPTIONS', 'exitcode=23,suppressions=@0@'.format( meson.current_source_dir() / 'installed-tests' / 'extra' / 'lsan.supp')) tests_environment.set('NO_AT_BRIDGE', '1') -tests_environment.set('LC_ALL', tests_locale) tests_environment.set('GSETTINGS_SCHEMA_DIR', js_tests_builddir) tests_environment.set('G_DEBUG', 'fatal-warnings,fatal-criticals') +tests_locale = 'N/A' +if cxx.get_id() != 'msvc' + result = run_command('build/choose-tests-locale.sh') + if result.returncode() == 0 + tests_locale = result.stdout().strip() + tests_environment.set('LC_ALL', tests_locale) + endif +endif + if not get_option('skip_gtk_tests') tests_environment.set('ENABLE_GTK', 'yes') endif @@ -650,7 +651,7 @@ gobject-introspection to run the tests. You can still build GJS, but some tests will fail.''') endif -if tests_locale == 'C' +if tests_locale == 'C' or tests_locale == 'N/A' warning('''Your libc does not have the C.UTF-8 locale and no other suitable UTF-8 fallback locale could be found. You can still build GJS, but some tests will fail.''') -- GitLab