File: gyptest-action.py

package info (click to toggle)
gyp 0.1%2B20200513gitcaa6002-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,236 kB
  • sloc: python: 29,408; ansic: 1,087; cpp: 855; sh: 302; lisp: 258; objc: 234; asm: 33; makefile: 10
file content (45 lines) | stat: -rwxr-xr-x 1,212 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python

# Copyright (c) 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""
Verifies actions with multiple outputs & dependncies will correctly rebuild.

This is a regression test for crrev.com/1177163002.
"""

from __future__ import print_function

import TestGyp
import os
import sys
import time

if sys.platform in ('darwin', 'win32'):
  print("This test is currently disabled: https://crbug.com/483696.")
  sys.exit(0)

test = TestGyp.TestGyp()

TESTDIR='relocate/src'
test.run_gyp('action.gyp', chdir='src')
test.relocate('src', TESTDIR)

def build_and_check(content):
  test.write(TESTDIR + '/input.txt', content)
  test.build('action.gyp', 'upper', chdir=TESTDIR)
  test.built_file_must_match('result.txt', content, chdir=TESTDIR)

build_and_check('Content for first build.')

# Ninja works with timestamps and the test above is fast enough that the
# 'updated' file may end up with the same timestamp as the original, meaning
# that ninja may not always recognize the input file has changed.
if test.format == 'ninja':
  time.sleep(1)

build_and_check('An updated input file.')

test.pass_test()