Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Commit

Permalink
Add testObsoleteHeaderDisappearsIncludes{Alphabetic,Reverse}()
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Warta committed Aug 1, 2016
1 parent ed28d52 commit 4f8b03e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
42 changes: 42 additions & 0 deletions integrationtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,48 @@ def testRequiredHeaderDisappears(self):
os.remove("info.h")
subprocess.check_call(compileCmd)

# When a header included by another header becomes obsolete and disappers,
# we must fall back to real compiler.
def testObsoleteHeaderDisappearsIncludesAlphabetic(self):
# A includes B
with cd(os.path.join(ASSETS_DIR, "header-miss-obsolete")):
compileCmd = CLCACHE_CMD + ["/I.", "/nologo", "/EHsc", "/c", "a_includes_b.cpp"]

with open("A.h", "w") as header:
header.write('#define INFO 1337\n')
header.write('#include "B.h"\n')
with open("B.h", "w") as header:
header.write('#define SOMETHING 1\n')

subprocess.check_call(compileCmd)

with open("A.h", "w") as header:
header.write('#define INFO 1337\n')
header.write('\n')
os.remove("B.h")

subprocess.check_call(compileCmd)

def testObsoleteHeaderDisappearsIncludesReverse(self):
# B includes A
with cd(os.path.join(ASSETS_DIR, "header-miss-obsolete")):
compileCmd = CLCACHE_CMD + ["/I.", "/nologo", "/EHsc", "/c", "b_includes_a.cpp"]

with open("A.h", "w") as header:
header.write('#define SOMETHING 1\n')
with open("B.h", "w") as header:
header.write('#define INFO 1337\n')
header.write('#include "A.h"\n')

subprocess.check_call(compileCmd)

os.remove("A.h")
with open("B.h", "w") as header:
header.write('#define INFO 1337\n')
header.write('\n')

subprocess.check_call(compileCmd)


class TestRunParallel(unittest.TestCase):
def _zeroStats(self):
Expand Down
5 changes: 5 additions & 0 deletions tests/integrationtests/header-miss-obsolete/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.obj

# headers auto-generated by tests
A.h
B.h
8 changes: 8 additions & 0 deletions tests/integrationtests/header-miss-obsolete/a_includes_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include "A.h"

int main()
{
std::cout << INFO << std::endl;
return 0;
}
8 changes: 8 additions & 0 deletions tests/integrationtests/header-miss-obsolete/b_includes_a.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include "B.h"

int main()
{
std::cout << INFO << std::endl;
return 0;
}

0 comments on commit 4f8b03e

Please sign in to comment.