2022-08-26 15:44:59 +00:00
|
|
|
# Copyright 2014 Google LLC. All Rights Reserved.
|
2014-07-16 20:47:57 +00:00
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
# https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
"""Packager testing global objects and attributes.
|
|
|
|
|
|
|
|
Please do not refer to this module directly. Please set attributes
|
|
|
|
either by updating the default values below, or by passing the requested
|
|
|
|
flags through the command line interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
# Define static global objects and attributes.
|
2016-04-20 00:42:40 +00:00
|
|
|
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
SRC_DIR = os.path.join(SCRIPT_DIR, os.pardir, os.pardir)
|
2014-07-16 20:47:57 +00:00
|
|
|
|
|
|
|
# Parse arguments and calculate dynamic global objects and attributes.
|
|
|
|
parser = argparse.ArgumentParser()
|
2016-01-07 19:29:19 +00:00
|
|
|
|
2020-06-04 21:30:14 +00:00
|
|
|
parser.add_argument('--test_update_golden_files', action='store_true')
|
2017-05-23 02:41:26 +00:00
|
|
|
|
2020-06-04 21:30:14 +00:00
|
|
|
parser.add_argument('--libpackager_type', default='static_library',
|
|
|
|
choices=['static_library', 'shared_library'])
|
2017-05-23 02:41:26 +00:00
|
|
|
|
2017-04-25 19:29:28 +00:00
|
|
|
parser.add_argument('--v')
|
|
|
|
parser.add_argument('--vmodule')
|
2017-03-23 18:05:22 +00:00
|
|
|
# Overwrite the test to encryption key/iv specified in the command line.
|
|
|
|
parser.add_argument('--encryption_key')
|
|
|
|
parser.add_argument('--encryption_iv')
|
|
|
|
|
|
|
|
parser.add_argument('--remove_temp_files_after_test',
|
|
|
|
dest='remove_test_files_after_test', action='store_true')
|
|
|
|
parser.add_argument('--no-remove_temp_files_after_test',
|
|
|
|
dest='remove_temp_files_after_test', action='store_false')
|
|
|
|
parser.set_defaults(remove_temp_files_after_test=True)
|
2016-01-07 19:29:19 +00:00
|
|
|
|
2014-07-16 20:47:57 +00:00
|
|
|
aes = parser.add_argument_group(
|
|
|
|
'aes flags',
|
|
|
|
'These flags are required to enable AES signed encryption tests.')
|
|
|
|
aes.add_argument('--aes_signing_key')
|
|
|
|
aes.add_argument('--aes_signing_iv')
|
|
|
|
rsa = parser.add_argument_group(
|
|
|
|
'rsa flags',
|
|
|
|
'These flags are required to enable RSA signed encryption tests.')
|
|
|
|
rsa.add_argument('--rsa_signing_key_path')
|
|
|
|
|
|
|
|
options, args = parser.parse_known_args()
|
|
|
|
sys.argv[1:] = args
|
|
|
|
has_aes_flags = False
|
2015-10-01 23:29:52 +00:00
|
|
|
if options.aes_signing_key and options.aes_signing_iv:
|
2014-07-16 20:47:57 +00:00
|
|
|
has_aes_flags = True
|
|
|
|
has_rsa_flags = False
|
2015-09-25 22:58:18 +00:00
|
|
|
if options.rsa_signing_key_path:
|
2014-07-16 20:47:57 +00:00
|
|
|
has_rsa_flags = True
|