mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Make more compatibility improvements
This commit is contained in:
parent
12d9e1e128
commit
55c6297e13
63 changed files with 513 additions and 80 deletions
|
@ -16,10 +16,12 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/cpuset.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/popcnt.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/sysconf.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
void SetUp(void) {
|
||||
|
@ -28,7 +30,25 @@ void SetUp(void) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(sched_getaffinity, test) {
|
||||
uint64_t s[16];
|
||||
EXPECT_SYS(0, 0, sched_getaffinity(0, sizeof(s), &s));
|
||||
TEST(sched_getaffinity, firstOnly) {
|
||||
cpu_set_t x, y;
|
||||
CPU_ZERO(&x);
|
||||
CPU_SET(0, &x);
|
||||
ASSERT_SYS(0, 0, sched_setaffinity(0, sizeof(x), &x));
|
||||
ASSERT_SYS(0, 0, sched_getaffinity(0, sizeof(y), &y));
|
||||
EXPECT_EQ(1, CPU_COUNT(&y));
|
||||
EXPECT_TRUE(CPU_ISSET(0, &y));
|
||||
EXPECT_FALSE(CPU_ISSET(1, &y));
|
||||
}
|
||||
|
||||
TEST(sched_getaffinity, secondOnly) {
|
||||
if (GetCpuCount() < 2) return;
|
||||
cpu_set_t x, y;
|
||||
CPU_ZERO(&x);
|
||||
CPU_SET(1, &x);
|
||||
ASSERT_SYS(0, 0, sched_setaffinity(0, sizeof(x), &x));
|
||||
ASSERT_SYS(0, 0, sched_getaffinity(0, sizeof(y), &y));
|
||||
EXPECT_EQ(1, CPU_COUNT(&y));
|
||||
EXPECT_FALSE(CPU_ISSET(0, &y));
|
||||
EXPECT_TRUE(CPU_ISSET(1, &y));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue