Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: tests/service_tests/multiple_services/multiple_snapshots_test.cc

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/service_tests/multiple_services/multiple_snapshots_test.cc
diff --git a/tests/service_tests/multiple_services/multiple_snapshots_test.cc b/tests/service_tests/multiple_services/multiple_snapshots_test.cc
deleted file mode 100644
index 323af4e6d1f56159c73b3a3aaede0cc4db876c52..0000000000000000000000000000000000000000
--- a/tests/service_tests/multiple_services/multiple_snapshots_test.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-#define TESTING
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "include/dartino_api.h"
-#include "include/service_api.h"
-
-#include "src/shared/assert.h" // NOLINT(build/include)
-#include "cc/service_one.h" // NOLINT(build/include)
-#include "cc/service_two.h" // NOLINT(build/include)
-
-static const int kDone = 1;
-
-static pthread_mutex_t mutex;
-static pthread_cond_t cond;
-static int status = 0;
-
-static void ChangeStatusAndNotify(int new_status) {
- pthread_mutex_lock(&mutex);
- status = new_status;
- pthread_cond_signal(&cond);
- pthread_mutex_unlock(&mutex);
-}
-
-static void WaitForStatus(int expected) {
- pthread_mutex_lock(&mutex);
- while (expected != status) pthread_cond_wait(&cond, &mutex);
- pthread_mutex_unlock(&mutex);
-}
-
-static void* DartThreadEntry(void* argv) {
- const char** paths = static_cast<const char**>(argv);
- DartinoSetup();
- DartinoProgram programs[2];
- int exitcodes[2];
- programs[0] = DartinoLoadSnapshotFromFile(paths[1]);
- programs[1] = DartinoLoadSnapshotFromFile(paths[2]);
- DartinoRunMultipleMain(2, programs, exitcodes, 0, NULL);
- DartinoDeleteProgram(programs[0]);
- DartinoDeleteProgram(programs[1]);
- DartinoTearDown();
- ChangeStatusAndNotify(kDone);
- return NULL;
-}
-
-static void SetupMultipleSnapshotsTest(int argc, char** argv) {
- pthread_mutex_init(&mutex, NULL);
- pthread_cond_init(&cond, NULL);
- ServiceApiSetup();
- pthread_t thread;
- int result = pthread_create(&thread, NULL, DartThreadEntry, argv);
- if (result != 0) {
- perror("Failed to start thread");
- exit(1);
- }
-}
-
-static void TearDownMultipleSnapshotsTest() {
- WaitForStatus(kDone);
- ServiceApiTearDown();
-}
-
-static void InteractWithServices() {
- ServiceOne::setup();
- ServiceTwo::setup();
-
- EXPECT_EQ(10, ServiceOne::echo(5));
- EXPECT_EQ(25, ServiceTwo::echo(5));
-
- ServiceTwo::tearDown();
- ServiceOne::tearDown();
-}
-
-int main(int argc, char** argv) {
- if (argc < 3) {
- printf("Usage: %s <snapshot_one> <snapshot_two>\n", argv[0]);
- return 1;
- }
- SetupMultipleSnapshotsTest(argc, argv);
- InteractWithServices();
- TearDownMultipleSnapshotsTest();
-}

Powered by Google App Engine
This is Rietveld 408576698