1<!DOCTYPE html> 2<!-- 3Copyright 2016 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7<html> 8<head> 9 <link type="text/css" rel="stylesheet" href="/dashboard/static/base.css"> 10 <link rel="import" href="/dashboard/elements/nav-bar.html"> 11 <title>Migrate Test Names</title> 12 <script> 13 'use strict'; 14 var XSRF_TOKEN = '{{xsrf_token}}'; 15 16 /** 17 * Loads and displays tests that match the "old pattern". 18 * @return {boolean} false (to prevent default click handler behavior). 19 */ 20 function listTests() { 21 function showPatternMatch() { 22 var arr = JSON.parse(xhr.responseText); 23 document.getElementById('test-list').innerHTML = arr.join('<br>'); 24 if (arr.length > 0) { 25 document.getElementById('form-submit').disabled = false; 26 } 27 } 28 29 var pattern = document.getElementById('old-pattern').value; 30 var xhr = new XMLHttpRequest(); 31 xhr.onload = showPatternMatch; 32 xhr.open('POST', '/list_tests'); 33 xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 34 xhr.send('type=pattern&has_rows=0&p=' + encodeURIComponent(pattern) + 35 '&xsrf_token=' + encodeURIComponent(window['XSRF_TOKEN'])); 36 document.getElementById('test-list').innerHTML = 37 '<img src="//www.google.com/images/loading.gif">'; 38 return false; 39 } 40 </script> 41</head> 42<body> 43 <nav-bar></nav-bar> 44 <h1>Migrate Test Names</h1> 45 46 <h2 style="color:red">If a test name has changed, 47 make sure to update all alerting!</h2> 48 49 <p>This page is a tool for migrating old data to a new test name.</p> 50 51 <p>The two input fields below should be filled in with two 52 "test path patterns". A test path is a slash-separated list of names of the 53 form "MasterName/bot-name/test_name/sub_test_name/...". A test path pattern 54 is a test path where any of the names can be replaced by the wildcard 55 character "*" After you fill in two test path patterns, you can list the tests 56 that match the old pattern to confirm. When you submit, test migration tasks 57 will be added to a task queue, and you'll be sent an email with the results 58 of the migration.</p> 59 60 <p>A rename consists of listing all Test entities which match the old test 61 path pattern. For each Test entity:</p> 62 <ul> 63 <li>A Test entity with the new name is created. 64 <li>Child test-entities from the old Test are re-parented to the new Test. 65 <li>Child Row entities (points) from the old Test are re-parented. 66 <li>All Anomaly entities are updated to reference the new Test. 67 <li>Finally, the old Test is deleted.</li> 68 </ul> 69 70 <p><b>Example usage:</b> To rename all traces like 71 <code>Total/t</code> and <code>Total/t_ref</code> to 72 Score/t</code> and <code>Score/t_ref</code> respectively for all 73 <code>sunspider/Total</code> tests on all masters and bots:</p> 74 75 <pre> old_pattern: */*/SunSpider/Total 76 new_pattern: */*/SunSpider/Score </pre> 77 78 <p>Parts of test names can also be deleted by enclosing a substring of a 79 name in brackets. For example, to re-parent all rows of 80 <code>blink_perf/Animation_<x></code> to 81 <code>blink_perf.animation/<x></code> and remove the "Animation_" 82 from trace names, you could input: 83 84 <pre> old_pattern: */*/blink_perf/Animation_* 85 new_pattern: */*/blink_perf.animation/[Animation_]</pre> 86 87 <form method="POST"> 88 <table> 89 <tr> 90 <td>Old pattern:</td> 91 <td> 92 <input type="text" size="125" 93 name="old_pattern" id="old-pattern" 94 style="font-family: monospace;" required> 95 </td> 96 </tr> 97 <tr> 98 <td>New pattern:</td> 99 <td> 100 <input type="text" size="125" 101 name="new_pattern" id="new-pattern" 102 style="font-family: monospace;" required> 103 </td> 104 </tr> 105 </table> 106 <input type="button" onclick="listTests();" value="List tests"> 107 <input type="submit" disabled value="Run Migration" id="form-submit"> 108 <div id="test-list"></div> 109 </form> 110</body> 111</html> 112