[vala/wip/meson: 63/64] meson: Add tests
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/meson: 63/64] meson: Add tests
- Date: Thu, 30 Nov 2017 15:16:45 +0000 (UTC)
commit 4a06bd6e077d9e7a41da1b0d7c7888bf78d5d7d1
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Aug 10 19:48:02 2017 +0200
meson: Add tests
meson.build | 1 +
tests/meson.build | 374 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/prepare-test.py | 17 +++
3 files changed, 392 insertions(+), 0 deletions(-)
---
diff --git a/meson.build b/meson.build
index 594251b..463d190 100644
--- a/meson.build
+++ b/meson.build
@@ -109,6 +109,7 @@ subdir('libvaladoc')
subdir('valadoc')
subdir('vapi')
subdir('doc')
+subdir('tests')
install_data('vala.m4', install_dir: join_paths('share', 'aclocal'))
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..022e0eb
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,374 @@
+test_cases = [
+ 'basic-types/integers.vala',
+ 'basic-types/escape-chars.vala',
+ 'basic-types/floats.vala',
+ 'basic-types/strings.vala',
+ 'basic-types/arrays.vala',
+ 'basic-types/pointers.vala',
+ 'basic-types/sizeof.vala',
+ 'basic-types/glists.vala',
+ 'basic-types/bug571486.vala',
+ 'basic-types/bug591552.vala',
+ 'basic-types/bug595751.vala',
+ 'basic-types/bug596637.vala',
+ 'basic-types/bug596785.vala',
+ 'basic-types/bug632322.vala',
+ 'basic-types/bug643612.vala',
+ 'basic-types/bug644046.vala',
+ 'basic-types/bug647222.vala',
+ 'basic-types/bug648364.vala',
+ 'basic-types/bug650993.vala',
+ 'basic-types/bug652380.vala',
+ 'basic-types/bug655908.vala',
+ 'basic-types/bug659975.vala',
+ 'basic-types/bug678791.vala',
+ 'basic-types/bug686336.vala',
+ 'basic-types/bug729907.vala',
+ 'basic-types/bug731017.vala',
+ 'basic-types/bug756376.vala',
+ 'basic-types/bug761307.vala',
+ 'basic-types/bug761736.vala',
+ 'basic-types/bug771626.test',
+ 'basic-types/bug772426.vala',
+ 'basic-types/bug777697.test',
+ 'basic-types/bug787152.vala',
+ 'basic-types/bug788775.vala',
+ 'chainup/class-base.vala',
+ 'chainup/class-base-foo.vala',
+ 'chainup/class-object.vala',
+ 'chainup/class-this.vala',
+ 'chainup/class-this-foo.vala',
+ 'chainup/no-chainup.vala',
+ 'chainup/struct-base.vala',
+ 'chainup/struct-base-foo.vala',
+ 'chainup/struct-this.vala',
+ 'chainup/struct-this-foo.vala',
+ 'pointers/bug590641.vala',
+ 'namespaces.vala',
+ 'methods/lambda.vala',
+ 'methods/closures.vala',
+ 'methods/prepostconditions.vala',
+ 'methods/symbolresolution.vala',
+ 'methods/bug595538.vala',
+ 'methods/bug596726.vala',
+ 'methods/bug597426.vala',
+ 'methods/bug598738.vala',
+ 'methods/bug599892.vala',
+ 'methods/bug613483.vala',
+ 'methods/bug620673.vala',
+ 'methods/bug622570.vala',
+ 'methods/bug626783.vala',
+ 'methods/bug639054.vala',
+ 'methods/bug642350.vala',
+ 'methods/bug642885.vala',
+ 'methods/bug642899.vala',
+ 'methods/bug646345.vala',
+ 'methods/bug648030.test',
+ 'methods/bug648320.vala',
+ 'methods/bug649562.vala',
+ 'methods/bug652098.vala',
+ 'methods/bug653391.vala',
+ 'methods/bug653908.vala',
+ 'methods/bug663210.vala',
+ 'methods/bug710862.vala',
+ 'methods/bug723009.vala',
+ 'methods/bug723195.vala',
+ 'methods/bug726347.vala',
+ 'methods/bug736235.vala',
+ 'methods/bug737222.vala',
+ 'methods/bug743877.vala',
+ 'methods/bug771964.vala',
+ 'methods/bug774060.vala',
+ 'methods/bug775466.test',
+ 'methods/bug781061.vala',
+ 'methods/bug784691.vala',
+ 'methods/generics.vala',
+ 'methods/printf-invalid.test',
+ 'methods/printf-constructor.vala',
+ 'methods/printf-constructor-invalid.test',
+ 'control-flow/break.vala',
+ 'control-flow/expressions-conditional.vala',
+ 'control-flow/for.vala',
+ 'control-flow/foreach.vala',
+ 'control-flow/nested-conditional.vala',
+ 'control-flow/switch.vala',
+ 'control-flow/sideeffects.vala',
+ 'control-flow/bug628336.vala',
+ 'control-flow/bug639482.vala',
+ 'control-flow/bug652549.vala',
+ 'control-flow/bug661985.vala',
+ 'control-flow/bug665904.vala',
+ 'control-flow/bug691514.vala',
+ 'control-flow/bug736774-1.vala',
+ 'control-flow/bug736774-2.vala',
+ 'control-flow/bug790903.test',
+ 'enums/enum_only.vala',
+ 'enums/enums.vala',
+ 'enums/flags.vala',
+ 'enums/bug666035.vala',
+ 'enums/bug673879.vala',
+ 'enums/bug763831.vala',
+ 'enums/bug780050.vala',
+ 'structs/struct_only.vala',
+ 'structs/structs.vala',
+ 'structs/gvalue.vala',
+ 'structs/bug530605.vala',
+ 'structs/bug572091.vala',
+ 'structs/bug583603.vala',
+ 'structs/bug595587.vala',
+ 'structs/bug596144.vala',
+ 'structs/bug603056.vala',
+ 'structs/bug606202.vala',
+ 'structs/bug609642.vala',
+ 'structs/bug613513.vala',
+ 'structs/bug613825.vala',
+ 'structs/bug621176.vala',
+ 'structs/bug622422.vala',
+ 'structs/bug623092.vala',
+ 'structs/bug651441.vala',
+ 'structs/bug654646.vala',
+ 'structs/bug654753.vala',
+ 'structs/bug656693.vala',
+ 'structs/bug657378.vala',
+ 'structs/bug658048.vala',
+ 'structs/bug660426.vala',
+ 'structs/bug661945.vala',
+ 'structs/bug667890.vala',
+ 'structs/bug669580.vala',
+ 'structs/bug685177.vala',
+ 'structs/bug686190.vala',
+ 'structs/bug690380.vala',
+ 'structs/bug694140.vala',
+ 'structs/bug749952.vala',
+ 'structs/bug764041.test',
+ 'structs/bug775761.vala',
+ 'structs/bug777194.vala',
+ 'delegates/casting.vala',
+ 'delegates/delegates.vala',
+ 'delegates/reference_transfer.vala',
+ 'delegates/bug539166.vala',
+ 'delegates/bug595610.vala',
+ 'delegates/bug595639.vala',
+ 'delegates/bug598869.test',
+ 'delegates/bug638415.vala',
+ 'delegates/bug639751.vala',
+ 'delegates/bug659778.vala',
+ 'delegates/bug683925.vala',
+ 'delegates/bug703804.vala',
+ 'delegates/bug761360.vala',
+ 'delegates/bug772204.test',
+ 'objects/chainup.vala',
+ 'objects/classes.vala',
+ 'objects/constructors.vala',
+ 'objects/generics.vala',
+ 'objects/fields.vala',
+ 'objects/interfaces.vala',
+ 'objects/methods.vala',
+ 'objects/properties.vala',
+ 'objects/regex.vala',
+ 'objects/signals.vala',
+ 'objects/signals-delegate.vala',
+ 'objects/test-025.vala',
+ 'objects/test-026.vala',
+ 'objects/test-029.vala',
+ 'objects/test-034.vala',
+ 'objects/bug566909.vala',
+ 'objects/bug587905.test',
+ 'objects/bug588203.vala',
+ 'objects/bug589928.vala',
+ 'objects/bug593260.vala',
+ 'objects/bug596621.vala',
+ 'objects/bug597155.vala',
+ 'objects/bug597161.vala',
+ 'objects/bug603491.test',
+ 'objects/bug613486.vala',
+ 'objects/bug613840.vala',
+ 'objects/bug620675.vala',
+ 'objects/bug620706.vala',
+ 'objects/bug624594.vala',
+ 'objects/bug626038.vala',
+ 'objects/bug628639.vala',
+ 'objects/bug631267.vala',
+ 'objects/bug634782.vala',
+ 'objects/bug641418-1.test',
+ 'objects/bug641418-2.test',
+ 'objects/bug641418-3.test',
+ 'objects/bug641828.vala',
+ 'objects/bug642809.vala',
+ 'objects/bug643711.vala',
+ 'objects/bug644938.vala',
+ 'objects/bug646362.vala',
+ 'objects/bug646792.vala',
+ 'objects/bug647018.vala',
+ 'objects/bug653138.vala',
+ 'objects/bug654702.vala',
+ 'objects/bug663134.vala',
+ 'objects/bug664529.vala',
+ 'objects/bug667668.vala',
+ 'objects/bug681356.vala',
+ 'objects/bug683646.vala',
+ 'objects/bug695671.vala',
+ 'objects/bug701978.vala',
+ 'objects/bug702736.vala',
+ 'objects/bug702846.vala',
+ 'objects/bug731547.vala',
+ 'objects/bug751338.vala',
+ 'objects/bug758816.vala',
+ 'objects/bug760031.test',
+ 'objects/bug764481.vala',
+ 'objects/bug767092.test',
+ 'objects/bug768823.test',
+ 'objects/bug773956-1.test',
+ 'objects/bug773956-2.test',
+ 'objects/bug615830-1.test',
+ 'objects/bug615830-2.test',
+ 'objects/bug766739.vala',
+ 'objects/bug778632.vala',
+ 'objects/bug779038-1.test',
+ 'objects/bug779038-2.test',
+ 'objects/bug779038-3.test',
+ 'objects/bug779219.vala',
+ 'objects/bug779955.vala',
+ 'objects/bug783897.vala',
+ 'objects/bug788964.vala',
+ 'errors/errors.vala',
+ 'errors/bug567181.vala',
+ 'errors/bug579101.vala',
+ 'errors/bug596228.vala',
+ 'errors/bug623049.vala',
+ 'errors/bug639589.vala',
+ 'errors/bug651145.vala',
+ 'errors/bug778224.vala',
+ 'asynchronous/bug595735.vala',
+ 'asynchronous/bug595755.vala',
+ 'asynchronous/bug596177.vala',
+ 'asynchronous/bug596861.vala',
+ 'asynchronous/bug597294.vala',
+ 'asynchronous/bug598677.vala',
+ 'asynchronous/bug598697.vala',
+ 'asynchronous/bug598698.vala',
+ 'asynchronous/bug599568.vala',
+ 'asynchronous/bug600827.vala',
+ 'asynchronous/bug601558.vala',
+ 'asynchronous/bug613484.vala',
+ 'asynchronous/bug620740.vala',
+ 'asynchronous/bug639591.vala',
+ 'asynchronous/bug640721.vala',
+ 'asynchronous/bug641182.vala',
+ 'asynchronous/bug646945.vala',
+ 'asynchronous/bug652252.vala',
+ 'asynchronous/bug653861.vala',
+ 'asynchronous/bug654336.vala',
+ 'asynchronous/bug654337.vala',
+ 'asynchronous/bug659886.vala',
+ 'asynchronous/bug661961.vala',
+ 'asynchronous/bug710103.vala',
+ 'asynchronous/bug741929.vala',
+ 'asynchronous/bug742621.vala',
+ 'asynchronous/bug762819.vala',
+ 'asynchronous/bug777242.vala',
+ 'asynchronous/bug783543.vala',
+ 'asynchronous/closures.vala',
+ 'asynchronous/generator.vala',
+ 'asynchronous/yield.vala',
+ 'annotations/deprecated.vala',
+ 'annotations/description.vala',
+ 'annotations/noaccessormethod.test',
+]
+
+dbus_test_cases = [
+ 'dbus/basic-types.test',
+ 'dbus/arrays.test',
+ 'dbus/structs.test',
+ 'dbus/errors.test',
+ 'dbus/async.test',
+ 'dbus/async-errors.test',
+ 'dbus/enum-string-marshalling.vala',
+ 'dbus/signals.test',
+ 'dbus/filedescriptor.test',
+ 'dbus/filedescriptor-errors.test',
+ 'dbus/dicts.test',
+ 'dbus/bug596862.vala',
+ 'dbus/bug602003.test',
+ 'dbus/bug782719.test',
+ 'dbus/rawvariants.test',
+]
+
+gir_test_cases = [
+ 'gir/bug651773.test',
+ 'gir/bug667751.test',
+ 'gir/bug742012.test',
+ 'gir/array-fixed-length.test',
+ 'gir/delegate-alias-without-target.test',
+]
+
+test_cases_non_null = [
+ 'nullability/bug611223.vala',
+]
+
+vala_flags = [
+ '--vapidir', join_paths(meson.source_root(), 'vapi'),
+ '--pkg', 'gio-2.0',
+ '--disable-warnings',
+ '--main', 'main', '--save-temps',
+ '-X', '-g',
+ '-X', '-O0',
+ '-X', '-pipe',
+ '-X', '-lm',
+ '-X', '-DGETTEXT_PACKAGE="valac"',
+ '-X', '-Werror=return-type',
+ '-X', '-Werror=init-self',
+ '-X', '-Werror=implicit',
+ '-X', '-Werror=sequence-point',
+ '-X', '-Werror=return-type',
+ '-X', '-Werror=uninitialized',
+ '-X', '-Werror=pointer-arith',
+ '-X', '-Werror=int-to-pointer-cast',
+ '-X', '-Werror=pointer-to-int-cast',
+ '-X', '-Wformat',
+ '-X', '-Werror=format-security',
+ '-X', '-Werror=format-nonliteral',
+ '-X', '-Werror=redundant-decls',
+ '-X', '-Werror=int-conversion'
+]
+
+vg = find_program('valgrind', required: false)
+if (vg.found())
+ add_test_setup('valgrind',
+ exe_wrapper: [vg, '--error-exitcode=1', '--leak-check=full', '--track-origins=yes '],
+ timeout_multiplier: 10,
+ )
+endif
+
+preparetest = find_program('prepare-test.py')
+
+foreach case : test_cases
+ if case.endswith('.vala')
+ test(case,
+ valac_exe,
+ workdir: meson.current_build_dir(),
+ args: vala_flags + [join_paths(meson.current_source_dir(), case)],
+ )
+ else
+ invalid_case = run_command(preparetest,
+ join_paths(meson.current_source_dir(), case),
+ join_paths(meson.current_build_dir(), case.underscorify() + '.vala'),
+ )
+ test(case,
+ valac_exe,
+ workdir: meson.current_build_dir(),
+ should_fail: true,
+ args: vala_flags + [case.underscorify() + '.vala'],
+ )
+ endif
+endforeach
+
+foreach case : test_cases_non_null
+ if case.endswith('.vala')
+ test(case,
+ valac_exe,
+ workdir: meson.current_build_dir(),
+ args: vala_flags + ['--enable-experimental-non-null',
join_paths(meson.current_source_dir(), case)],
+ )
+ endif
+endforeach
diff --git a/tests/prepare-test.py b/tests/prepare-test.py
new file mode 100644
index 0000000..bdf7502
--- /dev/null
+++ b/tests/prepare-test.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import sys, os, re
+from pathlib import Path
+
+if len(sys.argv) != 3:
+ print("Wrong amount of parameters.")
+
+inputf = Path(sys.argv[1])
+outputf = Path(sys.argv[2])
+
+with inputf.open('r') as ifile:
+ with outputf.open('w') as ofile:
+ if not ifile.readline().strip() == "Invalid Code":
+ ifile.seek(0)
+ lines = ifile.readlines()
+ ofile.writelines(lines)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]