Skip to content

Commit 6c9ae3b

Browse files
committed
Fix Azure pipelines
It was previously never reporting build errors.
1 parent f9a8d78 commit 6c9ae3b

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

azure-pipelines.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resources:
1010
options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro"
1111

1212
jobs:
13-
- job: Styleguide
13+
- job: Linux
1414
pool:
1515
vmImage: 'Ubuntu 16.04'
1616

@@ -32,17 +32,27 @@ jobs:
3232
sudo python3 setup.py install --optimize=1 --skip-build
3333
displayName: 'Build'
3434
- script: |
35+
# Make sure .git/refs/heads/master exists
36+
git config --global user.email "[email protected]"
37+
git config --global user.name "Your Name"
38+
git checkout -b pr
39+
git checkout master
40+
git checkout pr
41+
42+
cd wpiformat
3543
python3 setup.py test
44+
cd ..
45+
3646
python3 -m wpiformat -v
3747
cd wpiformat
3848
# One file
39-
python3 -m wpiformat -f wpiformat\__init__.py -v
49+
python3 -m wpiformat -f wpiformat/__init__.py -v
4050
4151
# Absolute path to file
42-
python3 -m wpiformat -f C:\projects\styleguide\wpiformat\wpiformat\__init__.py -v
52+
python3 -m wpiformat -f /__w/1/s/wpiformat/wpiformat/__init__.py -v
4353
4454
# Multiple files
45-
python3 -m wpiformat -f wpiformat\__init__.py wpiformat\__main__.py -v
55+
python3 -m wpiformat -f wpiformat/__init__.py wpiformat/__main__.py -v
4656
4757
# Directory
4858
python3 -m wpiformat -f wpiformat -v
@@ -51,7 +61,7 @@ jobs:
5161
git --no-pager diff --exit-code HEAD
5262
displayName: 'Test'
5363
54-
- job: WindowsStyleguide
64+
- job: Windows
5565
pool:
5666
vmImage: 'vs2017-win2016'
5767

@@ -66,14 +76,24 @@ jobs:
6676
py -3 setup.py install --optimize=1 --skip-build
6777
displayName: 'Build'
6878
- powershell: |
79+
# Make sure .git/refs/heads/master exists
80+
git config --global user.email "[email protected]"
81+
git config --global user.name "Your Name"
82+
git checkout -b pr
83+
git checkout master
84+
git checkout pr
85+
86+
cd wpiformat
6987
py -3 setup.py test
88+
cd ..
89+
7090
py -3 -m wpiformat -v
7191
cd wpiformat
7292
# One file
7393
py -3 -m wpiformat -f wpiformat\__init__.py -v
7494
7595
# Absolute path to file
76-
py -3 -m wpiformat -f C:\projects\styleguide\wpiformat\wpiformat\__init__.py -v
96+
py -3 -m wpiformat -f D:\a\1\s\wpiformat\wpiformat\__init__.py -v
7797
7898
# Multiple files
7999
py -3 -m wpiformat -f wpiformat\__init__.py wpiformat\__main__.py -v

wpiformat/test/test_includeguard.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22

33
from test.tasktest import *
44
from wpiformat.includeguard import IncludeGuard
5+
from wpiformat.task import Task
56

67

78
def test_includeguard():
89
test = TaskTest(IncludeGuard())
910

11+
repo_root = os.path.basename(Task.get_repo_root()).upper()
12+
1013
# Fix incorrect include guard
1114
test.add_input("./Test.h",
1215
"#ifndef WRONG_H" + os.linesep + \
1316
"#define WRONG_C" + os.linesep + \
1417
os.linesep + \
1518
"#endif" + os.linesep)
1619
test.add_output(
17-
"#ifndef STYLEGUIDE_TEST_H_" + os.linesep + \
18-
"#define STYLEGUIDE_TEST_H_" + os.linesep + \
20+
"#ifndef " + repo_root + "_TEST_H_" + os.linesep + \
21+
"#define " + repo_root + "_TEST_H_" + os.linesep + \
1922
os.linesep + \
20-
"#endif // STYLEGUIDE_TEST_H_" + os.linesep, True, True)
23+
"#endif // " + repo_root + "_TEST_H_" + os.linesep, True, True)
2124

2225
# Ensure nested preprocessor statements are handled properly for incorrect
2326
# include guard
@@ -30,20 +33,20 @@ def test_includeguard():
3033
"#endif" + os.linesep + \
3134
"#endif" + os.linesep)
3235
test.add_output(
33-
"#ifndef STYLEGUIDE_TEST_H_" + os.linesep + \
34-
"#define STYLEGUIDE_TEST_H_" + os.linesep + \
36+
"#ifndef " + repo_root + "_TEST_H_" + os.linesep + \
37+
"#define " + repo_root + "_TEST_H_" + os.linesep + \
3538
os.linesep + \
3639
"#if SOMETHING" + os.linesep + \
3740
"// do something" + os.linesep + \
3841
"#endif" + os.linesep + \
39-
"#endif // STYLEGUIDE_TEST_H_" + os.linesep, True, True)
42+
"#endif // " + repo_root + "_TEST_H_" + os.linesep, True, True)
4043

4144
# Don't touch correct include guard
4245
test.add_input("./Test.h",
43-
"#ifndef STYLEGUIDE_TEST_H_" + os.linesep + \
44-
"#define STYLEGUIDE_TEST_H_" + os.linesep + \
46+
"#ifndef " + repo_root + "_TEST_H_" + os.linesep + \
47+
"#define " + repo_root + "_TEST_H_" + os.linesep + \
4548
os.linesep + \
46-
"#endif // STYLEGUIDE_TEST_H_" + os.linesep)
49+
"#endif // " + repo_root + "_TEST_H_" + os.linesep)
4750
test.add_latest_input_as_output(True)
4851

4952
# Fail on missing include guard
@@ -56,27 +59,27 @@ def test_includeguard():
5659

5760
# Ensure include guard roots are processed correctly
5861
test.add_input("./Test.h",
59-
"#ifndef STYLEGUIDE_WPIFORMAT_TEST_H_" + os.linesep + \
60-
"#define STYLEGUIDE_WPIFORMAT_TEST_H_" + os.linesep + \
62+
"#ifndef " + repo_root + "_WPIFORMAT_TEST_H_" + os.linesep + \
63+
"#define " + repo_root + "_WPIFORMAT_TEST_H_" + os.linesep + \
6164
os.linesep + \
62-
"#endif // STYLEGUIDE_WPIFORMAT_TEST_H_" + os.linesep)
65+
"#endif // " + repo_root + "_WPIFORMAT_TEST_H_" + os.linesep)
6366
test.add_output(
64-
"#ifndef STYLEGUIDE_TEST_H_" + os.linesep + \
65-
"#define STYLEGUIDE_TEST_H_" + os.linesep + \
67+
"#ifndef " + repo_root + "_TEST_H_" + os.linesep + \
68+
"#define " + repo_root + "_TEST_H_" + os.linesep + \
6669
os.linesep + \
67-
"#endif // STYLEGUIDE_TEST_H_" + os.linesep, True, True)
70+
"#endif // " + repo_root + "_TEST_H_" + os.linesep, True, True)
6871

6972
# Ensure leading underscores are removed (this occurs if the user doesn't
7073
# include a trailing "/" in the include guard root)
7174
test.add_input("./Test/Test.h",
72-
"#ifndef STYLEGUIDE_WPIFORMAT_TEST_TEST_H_" + os.linesep + \
73-
"#define STYLEGUIDE_WPIFORMAT_TEST_TEST_H_" + os.linesep + \
75+
"#ifndef " + repo_root + "_WPIFORMAT_TEST_TEST_H_" + os.linesep + \
76+
"#define " + repo_root + "_WPIFORMAT_TEST_TEST_H_" + os.linesep + \
7477
os.linesep + \
75-
"#endif // STYLEGUIDE_WPIFORMAT_TEST_TEST_H_" + os.linesep)
78+
"#endif // " + repo_root + "_WPIFORMAT_TEST_TEST_H_" + os.linesep)
7679
test.add_output(
77-
"#ifndef STYLEGUIDE_TEST_H_" + os.linesep + \
78-
"#define STYLEGUIDE_TEST_H_" + os.linesep + \
80+
"#ifndef " + repo_root + "_TEST_H_" + os.linesep + \
81+
"#define " + repo_root + "_TEST_H_" + os.linesep + \
7982
os.linesep + \
80-
"#endif // STYLEGUIDE_TEST_H_" + os.linesep, True, True)
83+
"#endif // " + repo_root + "_TEST_H_" + os.linesep, True, True)
8184

8285
test.run(OutputType.FILE)

wpiformat/wpiformat/cpplint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def IsSourceFile(filename):
7171
return _source_regex.search(filename)
7272

7373

74-
_USAGE = """
74+
_USAGE = r"""
7575
Syntax: cpplint.py [--repository=path]
7676
[--headers=header_regex]
7777
[--srcs=src_regex]

0 commit comments

Comments
 (0)