Clang Project

clang_source_code/test/Modules/embed-files-compressed.cpp
1// REQUIRES: zlib
2// REQUIRES: shell
3//
4// RUN: rm -rf %t
5// RUN: mkdir %t
6// RUN: echo '//////////////////////////////////////////////////////////////////////' > %t/a.h
7// RUN: cat %t/a.h %t/a.h %t/a.h %t/a.h > %t/b.h
8// RUN: cat %t/b.h %t/b.h %t/b.h %t/b.h > %t/a.h
9// RUN: cat %t/a.h %t/a.h %t/a.h %t/a.h > %t/b.h
10// RUN: cat %t/b.h %t/b.h %t/b.h %t/b.h > %t/a.h
11// RUN: cat %t/a.h %t/a.h %t/a.h %t/a.h > %t/b.h
12// RUN: cat %t/b.h %t/b.h %t/b.h %t/b.h > %t/a.h
13// RUN: cat %t/a.h %t/a.h %t/a.h %t/a.h > %t/b.h
14// RUN: cat %t/b.h %t/b.h %t/b.h %t/b.h > %t/a.h
15// RUN: echo 'module a { header "a.h" }' > %t/modulemap
16//
17// RUN: %clang_cc1 -fmodules -I%t -fmodules-cache-path=%t -fmodule-name=a -emit-module %t/modulemap -fmodules-embed-all-files -o %t/a.pcm
18//
19// The above embeds ~4.5MB of highly-predictable /s and \ns into the pcm file.
20// Check that the resulting file is under 40KB:
21//
22// RUN: wc -c %t/a.pcm | FileCheck --check-prefix=CHECK-SIZE %s
23// CHECK-SIZE: {{(^|[^0-9])[123][0-9][0-9][0-9][0-9]($|[^0-9])}}
24