Commit 80fb4da
authored
Add file locking integration tests for php-wasm/node (#2908)
## Motivation for the change, related issues
We have automated tests for our file lock manager but no integration
tests to demonstrate locking is working between `@php-wasm/node`
instances. Let's fix that.
## Implementation details
This PR:
- Adds automated tests for file locking within `@php-wasm/node`
- Fixes a bug discovered by the additional tests: releasing flock()
locks when the associated file descriptor is closed.
The tests coordinate between two or more concurrent `@php-wasm`
instances using a simple text file to gate the stages. For example, for
php instances php1 and php2 testing exclusive locking:
- File initially contains "php1-locking"
- php1 starts without waiting
- php2 waits until file contains "php1-waiting-for-php2-to-try"
- php1 obtains an exclusive lock on a SQLite DB and sets file contents
to "php1-waiting-for-php2-to-try"
- php1 waits until file contains "php2-ready-for-unlock"
- php2 attempts to write to DB, records the outcome, and sets file
contents to "php2-ready-for-unlock"
- php2 waits until file contains "php1-unlocked"
- php1 unlocks the DB, sets file contents to "php1-unlocked", and exits
- php2 repeats its attempt to right the DB, records the outcome, echoes
its results, and exits
- the test case asserts expected outcome
Maybe there is a better way to coordinate between instances, but so far,
this seemed the most straightforward.
Once these tests are fleshed out, we can probably add nearly identical
tests for Playground CLI, but run the scripts via HTTP requests.
## Testing Instructions (or ideally a Blueprint)
- CI1 parent 8c80ae9 commit 80fb4da
File tree
46 files changed
+6166
-2352
lines changed- .github/workflows
- packages
- php-wasm
- compile/php
- node
- asyncify
- 7_2_34
- 7_3_33
- 7_4_33
- 8_0_30
- 8_1_33
- 8_2_29
- 8_3_27
- 8_4_14
- jspi
- 7_2_34
- 7_3_33
- 7_4_33
- 8_0_30
- 8_1_33
- 8_2_29
- 8_3_27
- 8_4_14
- src
- lib
- test
- util/src/lib
- playground/blueprints
- bin
- public
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+6166
-2352
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | | - | |
| 84 | + | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
85 | 87 | | |
86 | | - | |
| 88 | + | |
87 | 89 | | |
88 | | - | |
| 90 | + | |
89 | 91 | | |
90 | | - | |
| 92 | + | |
91 | 93 | | |
92 | | - | |
| 94 | + | |
93 | 95 | | |
94 | | - | |
| 96 | + | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| |||
0 commit comments