Skip to content

Commit

Permalink
Revert unintended modifications in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Dec 17, 2024
1 parent a327c7d commit 15a6a41
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 31 deletions.
43 changes: 21 additions & 22 deletions test/libc/intrin/pthread_mutex_lock_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,28 +197,27 @@ TEST(pthread_mutex_lock, rcontention) {
EXPECT_EQ(0, pthread_mutex_destroy(&mylock));
}

/* TEST(pthread_mutex_lock, econtention) { */
/* int i; */
/* pthread_mutexattr_t attr; */
/* pthread_mutexattr_init(&attr); */
/* pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); */
/* pthread_mutex_init(&mylock, &attr); */
/* pthread_mutexattr_destroy(&attr); */
/* count = 0; */
/* started = 0; */
/* finished = 0; */
/* for (i = 0; i < THREADS; ++i) { */
/* ASSERT_NE(-1, pthread_create(th + i, 0, MutexWorker, (void
* *)(intptr_t)i)); */
/* } */
/* for (i = 0; i < THREADS; ++i) { */
/* pthread_join(th[i], 0); */
/* } */
/* EXPECT_EQ(THREADS, started); */
/* EXPECT_EQ(THREADS, finished); */
/* EXPECT_EQ(THREADS * ITERATIONS, count); */
/* EXPECT_EQ(0, pthread_mutex_destroy(&mylock)); */
/* } */
TEST(pthread_mutex_lock, econtention) {
int i;
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
pthread_mutex_init(&mylock, &attr);
pthread_mutexattr_destroy(&attr);
count = 0;
started = 0;
finished = 0;
for (i = 0; i < THREADS; ++i) {
ASSERT_NE(-1, pthread_create(th + i, 0, MutexWorker, (void *)(intptr_t)i));
}
for (i = 0; i < THREADS; ++i) {
pthread_join(th[i], 0);
}
EXPECT_EQ(THREADS, started);
EXPECT_EQ(THREADS, finished);
EXPECT_EQ(THREADS * ITERATIONS, count);
EXPECT_EQ(0, pthread_mutex_destroy(&mylock));
}

void *SpinlockWorker(void *p) {
int i;
Expand Down
2 changes: 1 addition & 1 deletion test/libc/system/popen_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void *Worker(void *arg) {
}

TEST(popen, torture) {
int i, n = 40;
int i, n = 4;
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
testlib_extract("/zip/echo", "echo", 0755);
for (i = 0; i < n; ++i)
Expand Down
2 changes: 0 additions & 2 deletions test/libc/thread/pthread_cancel_deferred_cond_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

#include <cosmo.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
Expand All @@ -38,7 +37,6 @@ void* worker(void* arg) {
}

int main(int argc, char* argv[]) {
ShowCrashReports();
void* rc;
pthread_t th;
pthread_mutexattr_t at;
Expand Down
3 changes: 0 additions & 3 deletions test/posix/file_offset_exec_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

#include <cosmo.h>
#include <signal.h>
#include <stdatomic.h>
#include <stdio.h>
Expand All @@ -37,8 +36,6 @@ void on_unexpected_death(int sig) {
}

int main() {
GetSymbolTable();
ShowCrashReports();
signal(SIGCHLD, on_unexpected_death);

// extract test program
Expand Down
3 changes: 0 additions & 3 deletions test/posix/interprocess_signaling_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

#include <cosmo.h>
#include <signal.h>
#include <stdatomic.h>
#include <sys/mman.h>
Expand All @@ -27,8 +26,6 @@ void onsig(int sig) {

int main(int argc, char *argv[]) {

ShowCrashReports();

// create process shared memory
got = mmap(0, 4, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (got == MAP_FAILED)
Expand Down

0 comments on commit 15a6a41

Please sign in to comment.