Skip to content

Commit 8f17d48

Browse files
committed
Allow running session tests in parallel
Use unique session IDs and/or save paths. Also removes the annoying order-dependence of session tests.
1 parent 09f4f30 commit 8f17d48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+266
-252
lines changed

ext/session/tests/003.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class foo {
1717
function method() { $this->yes++; }
1818
}
1919

20-
session_id("abtest");
20+
session_id("test003");
2121
session_start();
2222
session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
2323

ext/session/tests/004.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class foo {
5555

5656
session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
5757

58-
session_id("abtest");
58+
session_id("test004");
5959
session_start();
6060
$_SESSION["baz"]->method();
6161
$_SESSION["arr"][3]->method();
@@ -75,7 +75,7 @@ session_destroy();
7575
?>
7676
--EXPECT--
7777
OPEN: PHPSESSID
78-
READ: abtest
78+
READ: test004
7979
object(foo)#2 (2) {
8080
["bar"]=>
8181
string(2) "ok"
@@ -91,9 +91,9 @@ array(1) {
9191
int(2)
9292
}
9393
}
94-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
94+
WRITE: test004, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
9595
OPEN: PHPSESSID
96-
READ: abtest
96+
READ: test004
9797
object(foo)#3 (2) {
9898
["bar"]=>
9999
string(2) "ok"
@@ -109,4 +109,4 @@ array(1) {
109109
int(2)
110110
}
111111
}
112-
DESTROY: abtest
112+
DESTROY: test004

ext/session/tests/005.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class foo {
5656

5757
session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
5858

59-
session_id("abtest");
59+
session_id("test005");
6060
session_start();
6161
session_decode($hnd->data);
6262

@@ -91,7 +91,7 @@ session_destroy();
9191
?>
9292
--EXPECT--
9393
OPEN: PHPSESSID
94-
READ: abtest
94+
READ: test005
9595
object(foo)#4 (2) {
9696
["bar"]=>
9797
string(2) "ok"
@@ -107,10 +107,10 @@ array(1) {
107107
int(2)
108108
}
109109
}
110-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
110+
WRITE: test005, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
111111
CLOSE
112112
OPEN: PHPSESSID
113-
READ: abtest
113+
READ: test005
114114
object(foo)#2 (2) {
115115
["bar"]=>
116116
string(2) "ok"
@@ -127,10 +127,10 @@ array(1) {
127127
}
128128
}
129129
int(123)
130-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
130+
WRITE: test005, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
131131
CLOSE
132132
OPEN: PHPSESSID
133-
READ: abtest
133+
READ: test005
134134
object(foo)#4 (2) {
135135
["bar"]=>
136136
string(2) "ok"
@@ -147,5 +147,5 @@ array(1) {
147147
}
148148
}
149149
int(123)
150-
DESTROY: abtest
150+
DESTROY: test005
151151
CLOSE

ext/session/tests/006.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ session.save_handler=files
1313
error_reporting(E_ALL);
1414
ob_start();
1515

16-
session_id("abtest");
16+
session_id("test006");
1717
session_start();
1818

1919
class a {

ext/session/tests/009.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ session.save_handler=files
1313
error_reporting(E_ALL);
1414
ob_start();
1515

16-
session_id("abtest");
16+
session_id("test009");
1717

1818
### Phase 1 cleanup
1919
session_start();
2020
session_destroy();
2121

2222
### Phase 2 $_SESSION["c"] does not contain any value
23-
session_id("abtest");
23+
session_id("test009");
2424
session_start();
2525
var_dump($_SESSION);
2626
$_SESSION["name"] = "foo";

ext/session/tests/012.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ error_reporting(E_ALL);
1414

1515
### Absurd example, value of $_SESSION does not matter
1616

17-
session_id("abtest");
17+
session_id("test012");
1818
session_start();
1919
$_SESSION["_SESSION"] = Array();
2020
$_SESSION = "kk";

ext/session/tests/013.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ session.save_handler=files
1212
<?php
1313
error_reporting(E_ALL);
1414

15-
session_id("abtest");
15+
session_id("test013");
1616
session_start();
1717
session_destroy();
18-
session_id("abtest2");
18+
session_id("test013-2");
1919
session_start();
2020
session_destroy();
2121

ext/session/tests/014.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ session.save_handler=files
1414
<?php
1515
error_reporting(E_ALL);
1616

17-
session_id("abtest");
17+
session_id("test014");
1818
session_start();
1919

2020
?>

ext/session/tests/015.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ session.save_handler=files
1616
<?php
1717
error_reporting(E_ALL);
1818

19-
session_id("abtest");
19+
session_id("test015");
2020
session_start();
2121
?>
2222
<a href="/link?<?php echo SID; ?>">
2323
<?php
2424
session_destroy();
2525
?>
2626
--EXPECT--
27-
<a href="/link?PHPSESSID=abtest&PHPSESSID=abtest">
27+
<a href="/link?PHPSESSID=test015&PHPSESSID=test015">

ext/session/tests/018.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ session.save_handler=files
1616

1717
error_reporting(E_ALL);
1818

19-
session_id("abtest");
19+
session_id("test018");
2020
session_start();
2121
?>
2222
<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php>
2323
<?php
2424
session_destroy();
2525
?>
2626
--EXPECT--
27-
<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="abtest" />
27+
<form accept-charset="ISO-8859-15, ISO-8859-1" action=url.php><input type="hidden" name="PHPSESSID" value="test018" />

ext/session/tests/019.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TFoo {
2323
}
2424
}
2525

26-
session_id("abtest");
26+
session_id("test019");
2727
session_start();
2828

2929
$_SESSION["o1"] = new TFoo(42);

ext/session/tests/020.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ session.save_handler=files
1717

1818
error_reporting(E_ALL);
1919

20-
session_id("abtest");
20+
session_id("test020");
2121
session_start();
2222
?>
2323
<a href="link.php?a=b">
2424
<?php
2525
session_destroy();
2626
?>
2727
--EXPECT--
28-
<a href="link.php?a=b&amp;PHPSESSID=abtest">
28+
<a href="link.php?a=b&amp;PHPSESSID=test020">

ext/session/tests/021.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ error_reporting(E_ALL);
1919
ini_set('session.trans_sid_hosts', 'php.net');
2020
$_SERVER['HTTP_HOST'] = 'php.net';
2121

22-
session_id("abtest");
22+
session_id("test021");
2323
session_start();
2424
?>
2525
<form action="//bad.net/do.php">
@@ -60,11 +60,11 @@ session_destroy();
6060
--EXPECT--
6161
<form action="//bad.net/do.php">
6262
<fieldset>
63-
<form action="//php.net/do.php"><input type="hidden" name="PHPSESSID" value="abtest" />
63+
<form action="//php.net/do.php"><input type="hidden" name="PHPSESSID" value="test021" />
6464
<fieldset>
65-
<form action="../do.php"><input type="hidden" name="PHPSESSID" value="abtest" />
65+
<form action="../do.php"><input type="hidden" name="PHPSESSID" value="test021" />
6666
<fieldset>
67-
<form action="/do.php"><input type="hidden" name="PHPSESSID" value="abtest" />
67+
<form action="/do.php"><input type="hidden" name="PHPSESSID" value="test021" />
6868
<fieldset>
69-
<form action="/foo/do.php"><input type="hidden" name="PHPSESSID" value="abtest" />
69+
<form action="/foo/do.php"><input type="hidden" name="PHPSESSID" value="test021" />
7070
<fieldset>

ext/session/tests/023.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class foo {
1717
function method() { $this->yes++; }
1818
}
1919

20-
session_id("abtest");
20+
session_id("test023");
2121
session_start();
2222
session_decode('baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}');
2323
$baz = $_SESSION['baz'];

ext/session/tests/024.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class foo {
5656

5757
session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
5858

59-
session_id("abtest");
59+
session_id("test024");
6060
session_start();
6161

6262
$baz = $_SESSION['baz'];
@@ -79,7 +79,7 @@ session_destroy();
7979
?>
8080
--EXPECTF--
8181
OPEN: PHPSESSID
82-
READ: abtest
82+
READ: test024
8383
object(foo)#%d (2) {
8484
["bar"]=>
8585
string(2) "ok"
@@ -95,9 +95,9 @@ array(1) {
9595
int(2)
9696
}
9797
}
98-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
98+
WRITE: test024, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
9999
OPEN: PHPSESSID
100-
READ: abtest
100+
READ: test024
101101
object(foo)#%d (2) {
102102
["bar"]=>
103103
string(2) "ok"
@@ -113,4 +113,4 @@ array(1) {
113113
int(2)
114114
}
115115
}
116-
DESTROY: abtest
116+
DESTROY: test024

ext/session/tests/025.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class foo {
5757

5858
session_set_save_handler(array($hnd, "open"), array($hnd, "close"), array($hnd, "read"), array($hnd, "write"), array($hnd, "destroy"), array($hnd, "gc"));
5959

60-
session_id("abtest");
60+
session_id("test025");
6161
session_start();
6262
$baz = $_SESSION['baz'];
6363
$arr = $_SESSION['arr'];
@@ -93,7 +93,7 @@ session_destroy();
9393
?>
9494
--EXPECTF--
9595
OPEN: PHPSESSID
96-
READ: abtest
96+
READ: test025
9797
object(foo)#%d (2) {
9898
["bar"]=>
9999
string(2) "ok"
@@ -109,10 +109,10 @@ array(1) {
109109
int(2)
110110
}
111111
}
112-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
112+
WRITE: test025, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:2;}}
113113
CLOSE
114114
OPEN: PHPSESSID
115-
READ: abtest
115+
READ: test025
116116
object(foo)#%d (2) {
117117
["bar"]=>
118118
string(2) "ok"
@@ -129,10 +129,10 @@ array(1) {
129129
}
130130
}
131131
int(123)
132-
WRITE: abtest, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
132+
WRITE: test025, baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:3;}}c|i:123;
133133
CLOSE
134134
OPEN: PHPSESSID
135-
READ: abtest
135+
READ: test025
136136
object(foo)#%d (2) {
137137
["bar"]=>
138138
string(2) "ok"
@@ -149,5 +149,5 @@ array(1) {
149149
}
150150
}
151151
int(123)
152-
DESTROY: abtest
152+
DESTROY: test025
153153
CLOSE

ext/session/tests/026.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ session.save_handler=files
1313
error_reporting(E_ALL);
1414
ob_start();
1515

16-
session_id("abtest");
16+
session_id("test026");
1717
session_start();
1818

1919
class a {

ext/session/tests/027.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ session.save_handler=files
1313
error_reporting(E_ALL);
1414
ob_start();
1515

16-
session_id("abtest");
16+
session_id("test027");
1717

1818
### Phase 1 cleanup
1919
session_start();
2020
session_destroy();
2121

2222
### Phase 2 $_SESSION["c"] does not contain any value
23-
session_id("abtest");
23+
session_id("test027");
2424
session_start();
2525
var_dump($_SESSION);
2626
$_SESSION["name"] = "foo";

ext/session/tests/CONFLICTS

Lines changed: 0 additions & 1 deletion
This file was deleted.

ext/session/tests/bug41600.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ session.save_handler=files
1717

1818
error_reporting(E_ALL);
1919

20-
session_id("abtest");
20+
session_id("bug41600");
2121
session_start();
2222
?>
2323
<a href="link.php?a=b">
2424
<?php
2525
session_destroy();
2626
?>
2727
--EXPECT--
28-
<a href="link.php?a=b&amp;PHPSESSID=abtest">
28+
<a href="link.php?a=b&amp;PHPSESSID=bug41600">

ext/session/tests/bug42596.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ session.serialize_handler=php
1515
session.save_handler=files
1616
--FILE--
1717
<?php
18-
$sessdir = __DIR__.'/sessions/';
18+
$sessdir = __DIR__.'/bug42596/';
1919
@rmdir($sessdir);
2020
mkdir($sessdir);
2121
$save_path = '0;0777;'.$sessdir;

0 commit comments

Comments
 (0)