diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-10-22 17:28:44 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-10-25 07:50:19 +0000 |
commit | e46b1f09fca2af0782648d14cac401ec62ac46b4 (patch) | |
tree | 86646d3edacd93108ec78fd9f150ce4e9b58c93d /tests/auto/blackbox/testdata | |
parent | d34f2b71c7eb73116e3f08bc9783fec81f450eb7 (diff) |
Prevent "dynamic" values from getting assigned to command properties
Values such as artifact objects are not plain data and we therefore must
not attempt to make deep copies of them. Catch attempts to assign them
to command properties.
Fixes: QBS-1404
Change-Id: I1fa02720a3543cd8e2c734ed9437d31b5a573d57
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'tests/auto/blackbox/testdata')
-rw-r--r-- | tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs | 16 |
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs index f3c10138a..7ed5f5d96 100644 --- a/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs +++ b/tests/auto/blackbox/testdata/generated-artifact-as-input-to-dynamic-rule/p.qbs @@ -45,8 +45,8 @@ Product { var cmd = new JavaScriptCommand(); var output = outputs["mytype.final"][0]; cmd.description = "generating " + output.fileName; - cmd.output = output; - cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; + cmd.outputFilePath = output.filePath; + cmd.sourceCode = function() { File.copy(input.filePath, outputFilePath); }; return [cmd]; } } diff --git a/tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs b/tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs index 28bcca827..b08fcd4a3 100644 --- a/tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs +++ b/tests/auto/blackbox/testdata/invalid-command-property/invalid-command-property.qbs @@ -1,6 +1,8 @@ import qbs.TextFile Product { + name: "p" + property string errorType type: ["output"] Group { files: ["input.txt"] @@ -15,11 +17,15 @@ Product { prepare: { var cmd = new JavaScriptCommand(); cmd.description = "Creating output"; - cmd.textFile = new TextFile(input.filePath, TextFile.ReadOnly); - cmd.sourceCode = function() { - var content = textFile.readAll(); - textFile.close(); - } + if (product.errorType === "qobject") + cmd.dummy = new TextFile(input.filePath, TextFile.ReadOnly); + else if (product.errorType === "input") + cmd.dummy = input; + else if (product.errorType === "artifact") + cmd.dummy = product.artifacts.qbs[0]; + else + throw "invalid error type " + product.errorType; + cmd.sourceCode = function() { } return [cmd]; } } |