|
6 | 6 |
|
7 | 7 | sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
|
8 | 8 |
|
9 |
| -from binding_generator import generate_bindings, get_file_list |
| 9 | +from binding_generator import _generate_bindings, _get_file_list |
| 10 | +from build_profile import generate_trimmed_api |
10 | 11 |
|
11 | 12 | api_filepath = "gdextension/extension_api.json"
|
12 | 13 | bits = "64"
|
13 | 14 | precision = "single"
|
14 | 15 | output_dir = "self_test"
|
15 | 16 |
|
16 |
| -generate_bindings(api_filepath, use_template_get_node=False, bits=bits, precision=precision, output_dir=output_dir) |
17 |
| -flist = get_file_list(api_filepath, output_dir, headers=True, sources=True) |
18 |
| - |
19 |
| -p = Path(output_dir) / "gen" |
20 |
| -allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")] |
21 |
| -missing = list(filter((lambda f: f not in flist), allfiles)) |
22 |
| -extras = list(filter((lambda f: f not in allfiles), flist)) |
23 |
| -if len(missing) > 0 or len(extras) > 0: |
24 |
| - print("Error!") |
25 |
| - for f in missing: |
26 |
| - print("MISSING: " + str(f)) |
27 |
| - for f in extras: |
28 |
| - print("EXTRA: " + str(f)) |
29 |
| - sys.exit(1) |
30 |
| -else: |
31 |
| - print("OK!") |
| 17 | + |
| 18 | +def test(profile_filepath=""): |
| 19 | + api = generate_trimmed_api(api_filepath, profile_filepath) |
| 20 | + _generate_bindings( |
| 21 | + api, |
| 22 | + use_template_get_node=False, |
| 23 | + bits=bits, |
| 24 | + precision=precision, |
| 25 | + output_dir=output_dir, |
| 26 | + ) |
| 27 | + flist = _get_file_list(api, output_dir, headers=True, sources=True) |
| 28 | + |
| 29 | + p = Path(output_dir) / "gen" |
| 30 | + allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")] |
| 31 | + missing = list(filter((lambda f: f not in flist), allfiles)) |
| 32 | + extras = list(filter((lambda f: f not in allfiles), flist)) |
| 33 | + if len(missing) > 0 or len(extras) > 0: |
| 34 | + print("Error!") |
| 35 | + for f in missing: |
| 36 | + print("MISSING: " + str(f)) |
| 37 | + for f in extras: |
| 38 | + print("EXTRA: " + str(f)) |
| 39 | + sys.exit(1) |
| 40 | + else: |
| 41 | + print("OK!") |
| 42 | + |
| 43 | + |
| 44 | +test() |
| 45 | +test("test/build_profile.json") |
0 commit comments