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

Unified Diff: tests/nameservice/nameservice_test.c

Issue 550523002: Remove the old "SecureRandom" service, formerly used by get_random_bytes() (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 3 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
« no previous file with comments | « src/trusted/service_runtime/service_runtime.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/nameservice/nameservice_test.c
diff --git a/tests/nameservice/nameservice_test.c b/tests/nameservice/nameservice_test.c
index 2a3d9ba950ad50795eab659ff85708f4ee0f44b9..f95b730d205e678cafe8acb243356b59c8bd2aba 100644
--- a/tests/nameservice/nameservice_test.c
+++ b/tests/nameservice/nameservice_test.c
@@ -12,51 +12,11 @@
#include <string.h>
#include <unistd.h>
+#include "native_client/src/include/nacl_assert.h"
#include "native_client/src/public/imc_syscalls.h"
#include "native_client/src/public/name_service.h"
#include "native_client/src/shared/srpc/nacl_srpc.h"
-#define RNG_OUTPUT_BYTES 1024
-
-#define BYTES_PER_LINE 32
-#define BYTE_SPACING 4
-
-void dump_output(int d, size_t nbytes) {
- uint8_t *bytes;
- int got;
- int copied;
- int ix;
-
- bytes = malloc(nbytes);
- if (!bytes) {
- perror("dump_output");
- fprintf(stderr, "No memory\n");
- return;
- }
- /* read output */
- for (got = 0; got < nbytes; got += copied) {
- copied = read(d, bytes + got, nbytes - got);
- if (-1 == copied) {
- perror("dump_output:read");
- fprintf(stderr, "read failure\n");
- break;
- }
- printf("read(%d, ..., %zd) -> %d\n", d, nbytes - got, copied);
- }
- /* hex dump it */
- for (ix = 0; ix < got; ++ix) {
- if (0 == (ix & (BYTES_PER_LINE-1))) {
- printf("\n%04x:", ix);
- } else if (0 == (ix & (BYTE_SPACING-1))) {
- putchar(' ');
- }
- printf("%02x", bytes[ix]);
- }
- putchar('\n');
-
- free(bytes);
-}
-
int main(void) {
int ns;
NaClSrpcChannel channel;
@@ -88,10 +48,15 @@ int main(void) {
return 1;
}
printf("rpc status %d\n", status);
- assert(NACL_NAME_SERVICE_SUCCESS == status);
- printf("rng descriptor %d\n", rng);
-
- dump_output(rng, RNG_OUTPUT_BYTES);
+ /*
+ * Now that the "SecureRandom" service has been removed, there is no
+ * service that is registered with the name service by default that we
+ * can test here. "ManifestNameService" only gets registered after the
+ * "reverse service" is initialized, which doesn't normally happen in
+ * standalone sel_ldr. So we just check that querying returns a sensible
+ * error here.
+ */
+ ASSERT_EQ(NACL_NAME_SERVICE_NAME_NOT_FOUND, status);
return 0;
}
« no previous file with comments | « src/trusted/service_runtime/service_runtime.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698