0
votes

I have a NaCl program that uses nacl_io. I'm looking for a way to run automated tests on it without relying on a browser. As long as I'm not using sockets, using set_ldr to run the executable seems to do the job. I can use mkdir() and create files, for example. However, calling socket() in my program fails with "Permission denied".

Does the fact that I'm using sockets means that I must run my tests in a browser?

If so, what is the best way to automate this kind of tests?

1

1 Answers

1
votes

There is no way to use real sockets from sel_ldr, but you can use test fakes instead.

For the nacl_io tests, we use fake Pepper interfaces that have simple implementations. See https://code.google.com/p/chromium/codesearch#chromium/src/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/.

We haven't yet implemented a fake socket interface, but it should be possible. You would need to implement the following interfaces:

Then when initalizing nacl_io in your tests, pass in your own PPB_GetInterface callback:

const void *my_get_interface(const char* interface_name) {
  if (strcmp(interface_name, PPB_MESSAGE_LOOP_INTERFACE_1_0) == 0) {
    return my_fake_message_loop_interface;
  } else if (...) {
  ...
}

nacl_io_init_ppapi(pp_instance, my_get_interface);