1#!/usr/bin/env python
2
3# Copyright 2015 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"""
8Verifies that ar_host is set correctly when enabling cross-compile on windows.
9"""
10
11import TestGyp
12
13import sys
14import os
15
16if sys.platform == 'win32':
17  test = TestGyp.TestGyp(formats=['ninja'])
18
19  CHDIR = 'lib-crosscompile'
20  oldenv = os.environ.copy()
21  try:
22    os.environ['GYP_CROSSCOMPILE'] = '1'
23    test.run_gyp('use_host_ar.gyp', chdir=CHDIR)
24  finally:
25    os.environ.clear()
26    os.environ.update(oldenv)
27
28  test.build('use_host_ar.gyp', test.ALL, chdir=CHDIR)
29  test.pass_test()
30