react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[RN][Testing] Make integration tests work in the New Architecture

Open cipolleschi opened this issue 7 months ago • 5 comments

Summary:

Working on #39719 with @Saadnajmi we realized that running the IntegrationTests with the New Architecture turned on resulted in a crash due to out-of-scope stack memory. I need to research more about this problem, but enabling the Address Sanitizer in Xcode fixed the tests.

Changelog:

[Internal] - Make IntegrationTests on iOS work with the New Architecture

Test Plan:

Tested locally

cipolleschi avatar Nov 07 '23 15:11 cipolleschi

Fails
:no_entry_sign:

Danger failed to run dangerfile.js.

Error ReferenceError

validateChangelog is not defined
ReferenceError: validateChangelog is not defined
    at Object.<anonymous> (dangerfile.js:50:18)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at requireFromString (/home/runner/work/react-native/react-native/node_modules/require-from-string/index.js:28:4)
    at /home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:157:68
    at step (/home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:52:23)
    at Object.next (/home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:33:53)
    at /home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:23:12)
    at runDangerfileEnvironment (/home/runner/work/react-native/react-native/node_modules/danger/distribution/runner/runners/inline.js:118:132)
    at /home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:178:38
    at step (/home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:44:23)
    at Object.next (/home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:25:53)
    at /home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:15:12)
    at Object.executeRuntimeEnvironment (/home/runner/work/react-native/react-native/node_modules/danger/distribution/platforms/GitHub.js:143:88)
    at /home/runner/work/react-native/react-native/node_modules/danger/distribution/commands/danger-runner.js:100:47
    at step (/home/runner/work/react-native/react-native/node_modules/danger/distribution/commands/danger-runner.js:34:23)
    at Object.next (/home/runner/work/react-native/react-native/node_modules/danger/distribution/commands/danger-runner.js:15:53)
    at fulfilled (/home/runner/work/react-native/react-native/node_modules/danger/distribution/commands/danger-runner.js:6:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Dangerfile

45|     'This will require a manual import by a Facebook employee.';
46|   warn(`${title} - <i>${idea}</i>`);
47| }
48| 
49| // Provides advice if a test plan is missing.
--------------------^
50| const includesTestPlan =
51|   danger.github.pr.body &&
52|   danger.github.pr.body.toLowerCase().includes('## test plan');
53| if (!includesTestPlan && !isFromPhabricator) {

Generated by :no_entry_sign: dangerJS against a5f9338447106fa68c32790e95b6f55a6a2aadaa

github-actions[bot] avatar Nov 07 '23 15:11 github-actions[bot]

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,634,321 +124
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,018,072 +9
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: b561d46b06a32e3872c4701ebeb325f8231e88dd Branch: main

analysis-bot avatar Nov 07 '23 16:11 analysis-bot

FWIW, I thought we already had it enabled in the xctestplan here, guess not?

https://github.com/facebook/react-native/pull/36443/

Saadnajmi avatar Nov 07 '23 16:11 Saadnajmi

I was investigate it further:

  • Is it true that we had already enabled them in https://github.com/facebook/react-native/pull/36443
  • Tests are crashing with the Address Sanitizer (ASAN) turned on
  • The change currently in this PR enables the ASAN from another setting
  • Enabling the ASAN twice, actually disable it! 😱😱😱😱😱😱😱 (I guess Apple implemented the flags as toggles... ¯_(ツ)_/¯)
  • The ideal state is not to crash with and without ASAN
  • I'm investigating more, but I'll need more help. We are accessing a variable outside of the scope, but I can't figure out which is the variable. Currently, it crashes here

cipolleschi avatar Nov 09 '23 16:11 cipolleschi

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 08 '24 05:05 github-actions[bot]