Ejemplo n.º 1
0
  def test_missing_sk_user_config(self):
    tmp = tempfile.mkdtemp()
    original = os.path.join(tmp, MISSING_FILENAME)
    assert not os.path.exists(original)


    # With require_sk_user_config set to True, an AssertionError will be
    # thrown when original_sk_user_config is missing.
    with self.assertRaises(AssertionError):
      ordered_set = [ 'define' ]
      gen_config(original_sk_user_config=original,
                 require_sk_user_config=True,
                 target_dir=tmp, ordered_set=ordered_set)

    # With require_sk_user_config set to False, it is okay for
    # original_sk_user_config to be missing.
    generate_dummy_user_config(original_sk_user_config=original,
                               require_sk_user_config=False, target_dir=tmp)
    actual_name = os.path.join(tmp, MISSING_FILENAME)
    utils.compare_to_expectation(actual_name=actual_name,
                                 expectation_name=MISSING_FILENAME,
                                 assert_true=self.assertTrue,
                                 msg=REBASELINE_MSG)

    shutil.rmtree(tmp)
Ejemplo n.º 2
0
    def test_missing_sk_user_config(self):
        tmp = tempfile.mkdtemp()
        original = os.path.join(tmp, MISSING_FILENAME)
        assert not os.path.exists(original)

        # With require_sk_user_config set to True, an AssertionError will be
        # thrown when original_sk_user_config is missing.
        with self.assertRaises(AssertionError):
            ordered_set = ['define']
            gen_config(original_sk_user_config=original,
                       require_sk_user_config=True,
                       target_dir=tmp,
                       ordered_set=ordered_set)

        # With require_sk_user_config set to False, it is okay for
        # original_sk_user_config to be missing.
        generate_dummy_user_config(original_sk_user_config=original,
                                   require_sk_user_config=False,
                                   target_dir=tmp)
        actual_name = os.path.join(tmp, MISSING_FILENAME)
        utils.compare_to_expectation(actual_name=actual_name,
                                     expectation_name=MISSING_FILENAME,
                                     assert_true=self.assertTrue,
                                     msg=REBASELINE_MSG)

        shutil.rmtree(tmp)
Ejemplo n.º 3
0
def generate_dummy_user_config(original_sk_user_config, target_dir):
  # Add an arbitrary set of defines
  defines = [ 'SK_BUILD_FOR_ANDROID',
              'SK_BUILD_FOR_ANDROID_FRAMEWORK',
              'SK_SCALAR_IS_FLOAT',
              'foo',
              'bar' ]
  gen_config(original_sk_user_config=original_sk_user_config,
             target_dir=target_dir, ordered_set=defines)
Ejemplo n.º 4
0
  def test_missing_sk_user_config(self):
    tmp = tempfile.mkdtemp()
    original = os.path.join(tmp, 'filename')
    assert not os.path.exists(original)

    with self.assertRaises(AssertionError):
      ordered_set = [ 'define' ]
      gen_config(original_sk_user_config=original, target_dir=tmp,
                 ordered_set=ordered_set)
    shutil.rmtree(tmp)
Ejemplo n.º 5
0
def generate_dummy_user_config(original_sk_user_config, require_sk_user_config,
                               target_dir):
    # Add an arbitrary set of defines
    defines = [
        'SK_BUILD_FOR_ANDROID', 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
        'SK_SCALAR_IS_FLOAT', 'foo', 'bar'
    ]
    gen_config(original_sk_user_config=original_sk_user_config,
               require_sk_user_config=require_sk_user_config,
               target_dir=target_dir,
               ordered_set=defines)