aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-17 14:22:09 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-17 14:22:09 -0700
commit2b17515b6860c22854d0794899a2b9d30f3dbc1b (patch)
tree9405d3585ccc78211f1991a1064e4ed4eecef771 /tests
parent31f73d04a0f1120746e40b7a35b5d609dbc598ab (diff)
parent56a3c81359687fd88bc27a0aca22c51f40e577c5 (diff)
Merge pull request #1288 from juj/dont_package_hidden_files
Report debug diagnostics in file packager if EMCC_DEBUG=1. Make file pac...
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/runner.py b/tests/runner.py
index e7434479..04baf47b 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -11822,6 +11822,9 @@ elif 'browser' in str(sys.argv):
def test_preload_file(self):
absolute_src_path = os.path.join(self.get_dir(), 'somefile.txt').replace('\\', '/')
open(absolute_src_path, 'w').write('''load me right before running the code please''')
+
+ absolute_src_path2 = os.path.join(self.get_dir(), '.somefile.txt').replace('\\', '/')
+ open(absolute_src_path2, 'w').write('''load me right before running the code please''')
def make_main(path):
print path
@@ -11846,6 +11849,7 @@ elif 'browser' in str(sys.argv):
test_cases = [
# (source preload-file string, file on target FS to load)
("somefile.txt", "somefile.txt"),
+ (".somefile.txt@somefile.txt", "somefile.txt"),
("./somefile.txt", "somefile.txt"),
("somefile.txt@file.txt", "file.txt"),
("./somefile.txt@file.txt", "file.txt"),
@@ -11874,11 +11878,13 @@ elif 'browser' in str(sys.argv):
# Test subdirectory handling with asset packaging.
os.makedirs(os.path.join(self.get_dir(), 'assets/sub/asset1/').replace('\\', '/'))
+ os.makedirs(os.path.join(self.get_dir(), 'assets/sub/asset1/.git').replace('\\', '/')) # Test adding directory that shouldn't exist.
os.makedirs(os.path.join(self.get_dir(), 'assets/sub/asset2/').replace('\\', '/'))
open(os.path.join(self.get_dir(), 'assets/sub/asset1/file1.txt'), 'w').write('''load me right before running the code please''')
+ open(os.path.join(self.get_dir(), 'assets/sub/asset1/.git/shouldnt_be_embedded.txt'), 'w').write('''this file should not get embedded''')
open(os.path.join(self.get_dir(), 'assets/sub/asset2/file2.txt'), 'w').write('''load me right before running the code please''')
absolute_assets_src_path = os.path.join(self.get_dir(), 'assets').replace('\\', '/')
- def make_main_two_files(path1, path2):
+ def make_main_two_files(path1, path2, nonexistingpath):
open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(self.with_report_result(r'''
#include <stdio.h>
#include <string.h>
@@ -11897,24 +11903,29 @@ elif 'browser' in str(sys.argv):
if (f == NULL)
result = 0;
fclose(f);
+
+ f = fopen("%s", "r");
+ if (f != NULL)
+ result = 0;
+
REPORT_RESULT();
return 0;
}
- ''' % (path1, path2)))
+ ''' % (path1, path2, nonexistingpath)))
test_cases = [
- # (source directory to embed, file1 on target FS to load, file2 on target FS to load)
- ("assets", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt"),
- ("assets/", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt"),
- ("assets@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"),
- ("assets/@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"),
- ("assets@./", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"),
- (absolute_assets_src_path + "@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"),
- (absolute_assets_src_path + "@/assets", "/assets/sub/asset1/file1.txt", "/assets/sub/asset2/file2.txt")]
+ # (source directory to embed, file1 on target FS to load, file2 on target FS to load, name of a file that *shouldn't* exist on VFS)
+ ("assets", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt", "assets/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ ("assets/", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt", "assets/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ ("assets@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt", "/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ ("assets/@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt", "/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ ("assets@./", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt", "/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ (absolute_assets_src_path + "@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt", "/sub/asset1/.git/shouldnt_be_embedded.txt"),
+ (absolute_assets_src_path + "@/assets", "/assets/sub/asset1/file1.txt", "/assets/sub/asset2/file2.txt", "assets/sub/asset1/.git/shouldnt_be_embedded.txt")]
for test in test_cases:
- (srcpath, dstpath1, dstpath2) = test
- make_main_two_files(dstpath1, dstpath2)
+ (srcpath, dstpath1, dstpath2, nonexistingpath) = test
+ make_main_two_files(dstpath1, dstpath2, nonexistingpath)
print srcpath
Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', srcpath, '-o', 'page.html']).communicate()
self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?1')