Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#4522 closed defect (fixed)

Template Manager test_load_all returns many errors

Reported by: fatherbushido Owned by: fatherbushido
Priority: Must Have Milestone: Alpha 23
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by fatherbushido)

It seems that this test needs to be updated.

Here is the kind of error I get:

ERROR: JavaScript error: simulation/components/BuildRestrictions.js line 339
ReferenceError: markForTranslationWithContext is not defined
  @simulation/components/BuildRestrictions.js:339:1
ERROR: CXeromyces: Parse error: in_memory_buffer:9: Element choice is empty
ERROR: RelaxNGValidator: Failed to compile schema
# campaigns/army_mace_hero_alexander
ERROR: RelaxNGValidator: No grammar loaded
ERROR: Failed to validate entity template 'campaigns/army_mace_hero_alexander'

In TestCmpTemplateManager_2::test_load_all:
/home/titi/0adsvn/source/simulation2/tests/test_CmpTemplateManager.h:254: Error: Assertion failed: p != __null
# campaigns/army_mace_standard

Attachments (1)

4522.diff (1.3 KB ) - added by Sandarac 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by fatherbushido, 7 years ago

Component: UI & SimulationCore engine

comment:2 by fatherbushido, 7 years ago

Description: modified (diff)
Priority: Should HaveMust Have

comment:3 by Sandarac, 7 years ago

It seems the issue is the mod mod is not added to the VFS in setUp() in TestCmpTemplateManager_2, which is needed as markForTranslationWithContext is defined in mods/mod/globalscripts/l10n.js. This test has been disabled since it was added in r7465, and I guess should stay that way (or at not least print the name of every template).

So now when the test is run with the mod mod, it just fails for special/actor.xml, the templates in /special_units, and some of the templates in special_filter. This is expected for /special_filter I guess (and shouldn't try to load those directly, or maybe it should), as those templates are dynamic, and the other failures are for templates that are pure "abstract" parent templates.

The attached patch doesn't try to get templates in /special_filter.

by Sandarac, 7 years ago

Attachment: 4522.diff added

comment:4 by elexis, 7 years ago

Nice research. Maybe it's nicer to omit the boost inclusion and just use substr to compare.

Also I'm not a fan of hardcoded paths in C++, placeablesFilter.json and so forth. Maybe special templates shouldn't be in that templates directory to begin with but in simulation/special_templates/ folder? (Just a thought that could be done somewhere else by someone else sometime later).

comment:5 by fatherbushido, 7 years ago

This test has been disabled since it was added in r7465, and I guess should stay that way (or at not least print the name of every template).

Sure. (As the code comment says). The test is also perhaps obsolete or not with those other scripts which needs the same kind of update see #4560 (and while at it #4550 :p)

Last edited 7 years ago by fatherbushido (previous) (diff)

comment:6 by fatherbushido, 7 years ago

Refs r20246

Just adding TS_ASSERT_OK(g_VFS->Mount(L"", DataDir()/"mods"/"mod", VFS_MOUNT_MUST_EXIST)); is enough. The other part of the patch is irrelevant since the commit above.

Last edited 6 years ago by fatherbushido (previous) (diff)

comment:7 by fatherbushido, 7 years ago

Owner: set to fatherbushido
Resolution: fixed
Status: newclosed

In 20326:

Fix a disabled template manager test.
Fix #4522
Patch by: Sandarac.
Reviewed by: elexis.
Differential Revision: https://code.wildfiregames.com/D968

comment:8 by fatherbushido, 7 years ago

Milestone: BacklogAlpha 23

Thx Sandarac

Note: See TracTickets for help on using tickets.