Skip to content

Commit 235032a

Browse files
authored
apacheGH-47633: [Dev][Integration] Write all files with --write_generated_json (apache#47634)
### Rationale for this change The `--write_generated_json` option to `archery integration` was originally a JS-specific hack, but its usage was removed from the JS codebase in commit [c65bcda60b899649c3daf6f16ff5c4e12a41f06d](apache/arrow-js@c65bcda). ### What changes are included in this PR? Rework this option to write all generated JSON integration files, not a subset of them. Also fix the option's spelling to use hyphens not underscores. ### Are these changes tested? Only manually. ### Are there any user-facing changes? No. * GitHub Issue: apache#47633 Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 79f9764 commit 235032a

2 files changed

Lines changed: 8 additions & 88 deletions

File tree

dev/archery/archery/cli.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def _set_default(opt, default):
691691
@click.option('--target-implementations', default='',
692692
help=('Target implementations in this integration tests'),
693693
envvar="ARCHERY_INTEGRATION_TARGET_IMPLEMENTATIONS")
694-
@click.option('--write_generated_json', default="",
694+
@click.option('--write-generated-json', default="",
695695
help='Generate test JSON to indicated path')
696696
@click.option('--run-ipc', is_flag=True, default=False,
697697
help='Run IPC integration tests')
@@ -714,7 +714,8 @@ def _set_default(opt, default):
714714
@click.option('-k', '--match',
715715
help=("Substring for test names to include in run, "
716716
"e.g. -k primitive"))
717-
def integration(with_all=False, random_seed=12345, **args):
717+
def integration(with_all=False, random_seed=12345, write_generated_json="",
718+
**args):
718719
"""If you don't specify the "--target-implementations" option nor
719720
the "ARCHERY_INTEGRATION_TARGET_IMPLEMENTATIONS" environment
720721
variable, test patterns are product of all specified
@@ -773,7 +774,8 @@ def integration(with_all=False, random_seed=12345, **args):
773774
774775
"""
775776

776-
from .integration.runner import write_js_test_json, run_all_tests
777+
from .integration.datagen import get_generated_json_files
778+
from .integration.runner import run_all_tests
777779
import numpy as np
778780

779781
# FIXME(bkietz) Include help strings for individual testers.
@@ -782,8 +784,6 @@ def integration(with_all=False, random_seed=12345, **args):
782784
# Make runs involving data generation deterministic
783785
np.random.seed(random_seed)
784786

785-
gen_path = args['write_generated_json']
786-
787787
implementations = ['cpp', 'dotnet', 'java', 'js', 'go', 'nanoarrow', 'rust']
788788
formats = ['ipc', 'flight', 'c_data']
789789

@@ -799,11 +799,9 @@ def integration(with_all=False, random_seed=12345, **args):
799799
param = f'run_{fmt}'
800800
enabled_formats += args[param]
801801

802-
if gen_path:
803-
# XXX See GH-37575: this option is only used by the JS test suite
804-
# and might not be useful anymore.
805-
os.makedirs(gen_path, exist_ok=True)
806-
write_js_test_json(gen_path)
802+
if write_generated_json:
803+
os.makedirs(write_generated_json, exist_ok=True)
804+
get_generated_json_files(tempdir=write_generated_json)
807805
else:
808806
if enabled_formats == 0:
809807
raise click.UsageError(

dev/archery/archery/integration/runner.py

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -750,81 +750,3 @@ def append_tester(implementation, tester):
750750
log(f"{fail_count} failures, {len(runner.skips)} skips")
751751
if fail_count > 0:
752752
sys.exit(1)
753-
754-
755-
def write_js_test_json(directory):
756-
datagen.generate_primitive_case([], name='primitive_no_batches').write(
757-
os.path.join(directory, 'primitive-no-batches.json')
758-
)
759-
datagen.generate_primitive_case([17, 20], name='primitive').write(
760-
os.path.join(directory, 'primitive.json')
761-
)
762-
datagen.generate_primitive_case([0, 0, 0], name='primitive_zerolength').write(
763-
os.path.join(directory, 'primitive-empty.json')
764-
)
765-
# datagen.generate_primitive_large_offsets_case([17, 20]).write(
766-
# os.path.join(directory, 'primitive-large-offsets.json')
767-
# )
768-
datagen.generate_null_case([10, 0]).write(
769-
os.path.join(directory, 'null.json')
770-
)
771-
datagen.generate_null_trivial_case([0, 0]).write(
772-
os.path.join(directory, 'null-trivial.json')
773-
)
774-
datagen.generate_decimal128_case().write(
775-
os.path.join(directory, 'decimal128.json')
776-
)
777-
# datagen.generate_decimal256_case().write(
778-
# os.path.join(directory, 'decimal256.json')
779-
# )
780-
datagen.generate_datetime_case().write(
781-
os.path.join(directory, 'datetime.json')
782-
)
783-
# datagen.generate_duration_case().write(
784-
# os.path.join(directory, 'duration.json')
785-
# )
786-
# datagen.generate_interval_case().write(
787-
# os.path.join(directory, 'interval.json')
788-
# )
789-
# datagen.generate_month_day_nano_interval_case().write(
790-
# os.path.join(directory, 'month_day_nano_interval.json')
791-
# )
792-
datagen.generate_map_case().write(
793-
os.path.join(directory, 'map.json')
794-
)
795-
datagen.generate_non_canonical_map_case().write(
796-
os.path.join(directory, 'non_canonical_map.json')
797-
)
798-
datagen.generate_nested_case().write(
799-
os.path.join(directory, 'nested.json')
800-
)
801-
datagen.generate_recursive_nested_case().write(
802-
os.path.join(directory, 'recursive-nested.json')
803-
)
804-
# datagen.generate_nested_large_offsets_case().write(
805-
# os.path.join(directory, 'nested-large-offsets.json')
806-
# )
807-
datagen.generate_unions_case().write(
808-
os.path.join(directory, 'unions.json')
809-
)
810-
datagen.generate_custom_metadata_case().write(
811-
os.path.join(directory, 'custom-metadata.json')
812-
)
813-
# datagen.generate_duplicate_fieldnames_case().write(
814-
# os.path.join(directory, 'duplicate-fieldnames.json')
815-
# )
816-
datagen.generate_dictionary_case().write(
817-
os.path.join(directory, 'dictionary.json')
818-
)
819-
datagen.generate_dictionary_unsigned_case().write(
820-
os.path.join(directory, 'dictionary-unsigned.json')
821-
)
822-
datagen.generate_nested_dictionary_case().write(
823-
os.path.join(directory, 'dictionary-nested.json')
824-
)
825-
# datagen.generate_run_end_encoded_case().write(
826-
# os.path.join(directory, 'run_end_encoded.json')
827-
# )
828-
datagen.generate_extension_case().write(
829-
os.path.join(directory, 'extension.json')
830-
)

0 commit comments

Comments
 (0)