blob: 77a3245d4625a0fc2afb94b3d1ba5e97fa0635e9 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001#!/usr/bin/env python
2
3# Copyright (c) 2012 Google Inc. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""
8Verify that .s files don't always trigger a rebuild, as would happen if depfiles
9were used for them (since clang & gcc ignore -MMD when building .s->.o on
10linux).
11"""
12
13import os
14import sys
15import TestCommon
16import TestGyp
17
18# NOTE(fischman): Each generator uses depfiles (or not) differently, so this is
19# a ninja-specific test.
20test = TestGyp.TestGyp(formats=['ninja'])
21
22if sys.platform == 'win32' or sys.platform == 'win64':
23 # This test is about clang/gcc vs. depfiles; VS gets a pass.
24 test.pass_test()
25 sys.exit(0)
26
27test.run_gyp('s-needs-no-depfiles.gyp')
28
29# Build the library, grab its timestamp, rebuild the library, ensure timestamp
30# hasn't changed.
31test.build('s-needs-no-depfiles.gyp', 'empty')
32empty_dll = test.built_file_path('empty', test.SHARED_LIB)
33test.built_file_must_exist(empty_dll)
34pre_stat = os.stat(test.built_file_path(empty_dll))
35test.sleep()
36test.build('s-needs-no-depfiles.gyp', 'empty')
37post_stat = os.stat(test.built_file_path(empty_dll))
38
39if pre_stat.st_mtime != post_stat.st_mtime:
40 test.fail_test()
41else:
42 test.pass_test()