Commit 1dac42f4 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[piexwasm] Add tests.sh script

Running tests will require a http server, puppeteer and some .js files
to do the actual testing in a browser. Add a script to drive the whole
testing process. Output:

  % npm run test
  tests PASS

If there was a test failure, a test.log is available to figure out the
problem.

Bug: 935285
Change-Id: I12f69008d37c67433901ed6a37a3d7e9375abac3
Reviewed-on: https://chromium-review.googlesource.com/c/1491155Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635923}
parent 0b65d886
#!/bin/bash
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PORT=8123
HTTP="http://localhost:${PORT}"
# Start test http server.
echo -e "test: starting test server ${HTTP}\n" > tests.log
node node_modules/http-server/bin/http-server -p ${PORT} > /dev/null 2>&1 &
HTTP_SERVER_PID=$!
# Extract preview thumbnails from the raw test images.
rm -f tests.hash
node tests.js ${HTTP}/tests.html "$*" | tee -a tests.log | \
grep hash > tests.hash
kill ${HTTP_SERVER_PID} > /dev/null 2>&1
# Compare their hash to the golden hash values.
if [[ $(cmp tests.hash images.golden.hash) ]]; then
echo "tests FAIL" || exit 1
else
echo "tests PASS"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment