-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to further improve code coverage
- Loading branch information
Showing
11 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--TEST-- | ||
Perfidious\Handle::read() | ||
--EXTENSIONS-- | ||
perfidious | ||
--SKIPIF-- | ||
<?php if (!Perfidious\DEBUG) die("skip: must be compiled in debug mode"); ?> | ||
--FILE-- | ||
<?php | ||
$rv = Perfidious\open([ | ||
"perf::PERF_COUNT_SW_CPU_CLOCK:u", | ||
]); | ||
$rv->enable(); | ||
for ($i = 0; $i < 100; $i++) { | ||
usleep(1); | ||
} | ||
$rv->debugCorruptMetricIds(); | ||
$value = $rv->read(); | ||
var_dump($value); | ||
--EXPECTF-- | ||
%A Uncaught DomainException: ID mismatch: %d != %d %A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
Perfidious\Handle::rawStream() - do dirty things part 4 | ||
--EXTENSIONS-- | ||
perfidious | ||
--FILE-- | ||
<?php | ||
$handle = Perfidious\open([ | ||
"perf::PERF_COUNT_SW_CPU_CLOCK:u", | ||
]); | ||
$stream = $handle->rawStream(); | ||
var_dump(strlen(fread($stream, 32))); | ||
fclose($stream); | ||
var_dump($handle->readArray()); | ||
--EXPECTF-- | ||
int(32) | ||
%A Uncaught Perfidious\IOException: failed to read: Bad file descriptor %A | ||
%A Uncaught Perfidious\IOException: close failed: Bad file descriptor %A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--TEST-- | ||
Perfidious\Handle (open fails with missing cap, debug) | ||
--EXTENSIONS-- | ||
perfidious | ||
--SKIPIF-- | ||
<?php if (get_current_user() === 'root' || str_contains(get_current_user(), 'nixbld')) die("skip: would fail as root"); ?> | ||
<?php if (!Perfidious\DEBUG) die("skip: must be compiled in debug mode"); ?> | ||
--FILE-- | ||
<?php | ||
// Note: this test will fail if run with CAP_PERFMON (e.g. as root) | ||
$rv = Perfidious\open([ | ||
"perf::PERF_COUNT_SW_CPU_CLOCK:u", | ||
], pid: 1); | ||
--EXPECTF-- | ||
%A Uncaught Perfidious\IOException: perf_event_open() failed for perf::PERF_COUNT_SW_DUMMY: Permission denied %A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Perfidious\Handle::rawStream() - invalid idx | ||
--EXTENSIONS-- | ||
perfidious | ||
--FILE-- | ||
<?php | ||
$handle = Perfidious\open([ | ||
"perf::PERF_COUNT_SW_CPU_CLOCK:u", | ||
]); | ||
$handle->enable(); | ||
$stream = $handle->rawStream(PHP_INT_MAX); | ||
var_dump($stream); | ||
--EXPECT-- | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--TEST-- | ||
Perfidious\Handle | ||
Perfidious\Handle::rawStream() | ||
--EXTENSIONS-- | ||
perfidious | ||
--FILE-- | ||
|