Project

Profile

Help

Bug #4976

closed

Inadequate bytecode testing: unfolded option on empty sequence

Added by Michael Kay about 1 year ago. Updated 27 days ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-04-23
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Many of the W3C test cases can be defeated by an optimiser that does early evaluation: for example all the starts-with tests in which one of the operands is an empty sequence actually write the operand as "()", which means there are no tests for the case where the operand value is found to be an empty sequence at run-time. We compensate for this with the -unfolded option in the test driver, which modifies the query so that literals are replaced by expressions that return the relevant value at run-time but cannot be eagerly evaluated.

But the -unfolded option has no effect on the literal value "()", because the mechanism relies on trace code injection, and the trace code injector is not called when we generate this expression. This means that the dynamic-empty-sequence case is often untested. This particularly affects tests for byte code generation.

Actions #1

Updated by Michael Kay about 1 year ago

I've fixed this on the 11.x branch, but it still leaves the relevant paths untested, because when we use -unfolded, the effect is that the collation passed to a function like starts-with is itself "unfolded", which means that the collation is not statically known, and we do not generate bytecode for the rare case of a function call whose collation parameter is evaluated dynamically.

Actions #2

Updated by Michael Kay about 1 year ago

  • Status changed from New to In Progress

Starting with the fn-contains-token and fn-contains test sets in QT4, I've added some new tests (suffixed -dyn) that modify existing tests by using external variables in place of literals in the query.

Actions #3

Updated by Michael Kay 27 days ago

  • Status changed from In Progress to Resolved

I've added some more such tests for ends-with; but addition of new tests can go on for ever, and the process isn't finding any new bugs, so we have to stop somewhere. I'm therefore closing the issue.

Please register to edit this issue

Also available in: Atom PDF