Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash and no report generated #28

Open
henawey-t opened this issue Oct 6, 2024 · 2 comments
Open

Crash and no report generated #28

henawey-t opened this issue Oct 6, 2024 · 2 comments

Comments

@henawey-t
Copy link

henawey-t commented Oct 6, 2024

Crash and no report generated

stderr: "unhandled error during finalization of test:
........./test/src/modules/food_list/widgets/cuisines/cuisine_circle_item_widget_test.dart
PathNotFoundException: Deletion failed, path = '/var/folders/xw/c1n3rzmn62g86nznh6ch449c0000gq/T/flutter_tools.BMkEKQ/flutter_test_listener.sSSz2V' (OS Error: No such file or directory, errno = 2)
#0      _Directory._deleteSync (dart:io/directory_impl.dart:188:7)
#1      FileSystemEntity.deleteSync (dart:io/file_system_entity.dart:407:7)
#2      ForwardingFileSystemEntity.deleteSync (package:file/src/forwarding/forwarding_file_system_entity.dart:70:16)
#3      ErrorHandlingDirectory.deleteSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:492:22)
#4      _runSync (package:flutter_tools/src/base/error_handling_io.dart:600:14)
#5      ErrorHandlingDirectory.deleteSync (package:flutter_tools/src/base/error_handling_io.dart:491:12)
#6      FlutterPlatform._createListenerDart.<anonymous closure> (package:flutter_tools/src/test/flutter_platform.dart:617:15)
#7      FlutterPlatform._startTest (package:flutter_tools/src/test/flutter_platform.dart:581:26)
<asynchronous suspension>
#8      Future.wait.<anonymous closure> (dart:async/future.dart:534:21)
<asynchronous suspension>
#9      _FlutterPlatformStreamSinkWrapper.close.<anonymous closure> (package:flutter_tools/src/test/flutter_platform.dart:691:7)
<asynchronous suspension>

"

however, the flutter test is working fine.

Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2663184aa7 (4 weeks ago) • 2024-09-11 16:27:48 -0500
Engine • revision 36335019a8
Tools • Dart 3.5.3 • DevTools 2.37.3

@henawey-t
Copy link
Author

henawey-t commented Oct 9, 2024

fixed by creating rules.xml with custom command of

<commands>
   <command group="test" expected-return="0" working-directory=".">flutter test</command>
 </commands>

@ElanDeyan
Copy link

Hi, I'm getting the same problem, where should I add this commands tag?

<?xml version="1.0" encoding="UTF-8"?>
<mutations version="1.1">
  <!-- The rules element describes all mutations done during a mutation test -->
  <!-- The following children are parsed: literal and regex -->
  <!-- A literal element matches the literal text -->
  <!-- A regex element mutates source code if the regular expression matches -->
  <!-- Each of them must have at least one mutation child -->
  <commands>
   <command group="test" expected-return="0" working-directory=".">flutter test</command>
  </commands>
  <rules>
    <!-- A literal element matches the literal text and replaces it with the list of mutations  -->
    <!-- Replaces 'and' and 'or'  with each other -->
    <literal text="&amp;&amp;" id="builtin.and">
      <mutation text="||"/>
    </literal>
    <literal text="||" id="builtin.or">
      <mutation text="&amp;&amp;"/>
    </literal>
    <!-- Replaces assignments with other assignments -->
    <literal text="+=" id="builtin.op.add_assign">
      <mutation text="="/>
    </literal>
    <literal text="-=" id="builtin.op.sub_assign">
      <mutation text="="/>
    </literal>
    <literal text="*=" id="builtin.op.mul_assign">
      <mutation text="="/>
    </literal>
    <literal text="/=" id="builtin.op.div_assign">
      <mutation text="="/>
    </literal>
    <literal text="&=" id="builtin.op.and_assign">
      <mutation text="="/>
    </literal>
    <literal text="^=" id="builtin.op.or_assign">
      <mutation text="="/>
    </literal>
    <!-- Replaces comparison operators -->
    <literal text="==" id="builtin.op.eq">
      <mutation text="!="/>
    </literal>
    <literal text="!=" id="builtin.op.neq">
      <mutation text="=="/>
    </literal>
    <literal text="&lt;=" id="builtin.op.leq">
      <mutation text="=="/>
      <mutation text="&lt;"/>
    </literal>
    <literal text="&gt;=" id="builtin.op.geq">
      <mutation text="=="/>
      <mutation text="&gt;"/>
    </literal>
    <!-- It is also possible to match a regular expression with capture groups. -->
    <!-- If the optional attribute dotAll is set to true, then the . will also match newlines.  -->
    <!-- If not present, the default value for dotAll is false.  -->
    <!-- Here, we capture everything inside of the braces of "if ()" -->
    <regex pattern="[\s]if[\s]*\((.*?)\)[\s]*{" dotAll="true" id="builtin.if">
      <!-- You can access groups via $1. -->
      <!-- If your string contains a $ followed by a number that should not be replaced, escape the dollar \$ -->
      <!-- If your string contains a \$ followed by a number that should not be replaced, escape the slash \\$ -->
      <!-- Tabs and newlines should also be escaped. -->
      <mutation text=" if (!($1)) {"/>
    </regex>
    <!-- Matches long chains of && -->
    <regex pattern="&amp;([^&amp;()]+?)&amp;" dotAll="true" id="builtin.logical.and_chain">
      <mutation text="&amp;!($1)&amp;"/>
    </regex>
    <!-- Matches long chains of || -->
    <regex pattern="\|([^|()]+?)\|" dotAll="true" id="builtin.logical.or_chain">
      <mutation text="|!($1)|"/>
    </regex>
    <regex pattern="\(([^$(]*?)&amp;&amp;([^$()]*?)\)" id="builtin.logical.and_chain2">
      <mutation text="(!($1)&amp;&amp;$2)"/>
      <mutation text="($1&amp;&amp;!($2))"/>
    </regex>
    <regex pattern="\(([^|(]*?)\|\|([^()|]*?)\)" id="builtin.logical.or_chain2">
      <mutation text="(!($1)||$2)"/>
      <mutation text="($1||!($2))"/>
    </regex>
    <!-- Replace start of conditional block -->
    <regex pattern="if\s*\(([^|&amp;\)]*?)([|&amp;][|&amp;])" id="builtin.if.start">
      <mutation text="if (!($1)$2"/>
    </regex>
    <!-- Replace end of conditional block -->
    <regex pattern="([|&amp;][|&amp;])([^|&amp;]*?)\)" id="builtin.if.end">
      <mutation text="$1!($2))"/>
    </regex>
    <regex pattern="([|&amp;][|&amp;])[\s]*?\(" dotAll="true" id="builtin.logical.chain_not">
      <mutation text="$1!("/>
    </regex>
    <!-- Replaces numbers with negative values -->
    <regex pattern="([\s=\(])([1-9\.]+[0-9]+|0\.0*[1-9])" id="builtin.number.negative">
      <mutation text="$1-$2"/>
    </regex>
    <!-- checks if neighboring arguments may have been mixed up -->
    <!-- switch function call arguments. Matches 2 args -->
    <regex pattern="([\s][a-zA-Z]+?[^(;\s{}]*?)\s*\(([^,:;{}(]+?),([^,:;{}(]+?)\)\s*;" id="builtin.function.arg2">
      <mutation text="$1($3,$2);"/>
    </regex>
    <!-- switch function call arguments. Matches 3 args -->
    <regex pattern="([\s][a-zA-Z]+?[^\(;\s{}]*?)\s*\(([^,:;{}(]+?),([^,:;{}(]+?),([^,:;{}(]+?)\)\s*;" id="builtin.function.arg3">
      <mutation text="$1($3,$2,$4);"/>
      <mutation text="$1($2,$4,$3);"/>
    </regex>
    <!-- switch function call arguments. Matches 4 args -->
    <regex pattern="([\s][a-zA-Z]+?[^\(;\s{}]*?)\s*\(([^,:;{}(]+?),([^,:;{}(]+?),([^,:;{}(]+?),([^,:;{}(]+?)\)\s*;"  id="builtin.function.arg4">
      <mutation text="$1($3,$2,$4,$5);"/>
      <mutation text="$1($2,$4,$3,$5);"/>
      <mutation text="$1($2,$3,$5,$4);"/>
    </regex>
    <!-- Replaces arithmetic operators with their opposite -->
    <regex pattern="\+([^=])" id="builtin.arith.add">
      <mutation text="-$1"/>
    </regex>
    <regex pattern="-([^=])" id="builtin.arith.sub">
      <mutation text="+$1"/>
    </regex>
    <regex pattern="\*([^=])" id="builtin.arith.mul">
      <mutation text="/$1"/>
    </regex>
    <regex pattern="/([^=])" id="builtin.arith.div">
      <mutation text="*$1"/>
    </regex>
    <!-- Removes break; statements for c++ switches -->
    <regex pattern="break;(\s+)case" id="builtin.switch.break">
      <mutation text="$1case"/>
    </regex>
    <!-- Removes entries in a list in dart -->
    <regex pattern="([=:>]\s*)\[([^\],]+),([^\]]+)\]" id="builtin.list.clear">
      <mutation text="$1[]"/>
    </regex>
    <!-- Removes function calls that are not returned or assigned to a value -->
    <regex pattern="([{]\s*)([^\(;=\s}]+\([^;]+\)\s*;)" id="builtin.function.removeVoidCall1">
      <mutation text="$1"/>
    </regex>
    <regex pattern="([};]\s*)([^\(;=\s}]+\([^;]+\)\s*;)" id="builtin.function.removeVoidCall2">
      <mutation text="$1"/>
    </regex>
  </rules>
  <!-- This element creates a blacklist, allowing you to exclude parts from the mutations -->
  <exclude>
    <!-- excludes anything between two tokens  -->
    <!-- single line comments  -->
    <token begin="//" end="\n"/>
    <!-- exclude dart exports and imports  -->
    <token begin="export &apos;" end="&apos;;"/>
    <token begin="import &apos;" end="&apos;;"/>
    <token begin="export &quot;" end="&quot;;"/>
    <token begin="import &quot;" end="&quot;;"/>
    <!-- excludes anything that matches a pattern  -->
    <!-- multi line comments  -->
    <regex pattern="/[*].*?[*]/" dotAll="true"/>
    <!-- exclude increment and decrement operators. Produces mostly false positives.  -->
    <regex pattern="\+\+"/>
    <regex pattern="--"/>
    <!-- excludes loops from mutations to prevent tests to run forever -->
    <regex pattern="[\s]for[\s]*\(.*?\)[\s]*{" dotAll="true"/>
    <regex pattern="[\s]while[\s]*\(.*?\)[\s]*{.*?}" dotAll="true"/>
    <!-- lines can also be globally excluded  -->
    <!-- line index starts at 1  -->
    <!-- lines begin="1" end="2"/-->
    <!-- It is possible to exclude files using the file element. -->
    <!-- <file>path/to/exclude.dart</file> -->
  </exclude>
</mutations>

Command:

dart run mutation_test -r mutation_test_default_config.xml

Output:

Found 45 mutations in 21 source files!
Error while processing:
  ProcessException: O sistema não pode encontrar o arquivo especificado.

  Command: flutter test

3.24.3 Flutter SDK
3.5.3 (Flutter) Dart SDK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants