Skip to content

Commit

Permalink
automatic commit at releng box
Browse files Browse the repository at this point in the history
  • Loading branch information
mc36 committed Mar 30, 2022
1 parent 893a0ad commit ddc19c5
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 16 deletions.
4 changes: 3 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13090,6 +13090,8 @@ no todo: incremental fib calculation from bgp change list
---------------------------------- 2022-03-29 13:48:35
todo: aliases with sticky parameters
todo: disableable door code in temper
---------------------------------- 2022-03-30 04:34:50
---------------------------------- 2022-03-30 04:34:50 22.3.30
todo: lsrp pvrp forbid remote dynamic metric
todo: changelog converter with start point
---------------------------------- 2022-03-30 07:02:48 22.3.30
no todo: lsrp pvrp forbid remote dynamic metric
2 changes: 2 additions & 0 deletions src/net/freertr/user/userExec.java
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,8 @@ public userHelping getHelping() {
hl.add(null, "3 3,. <str> parameter");
hl.add(null, "2 3,. tester perform image tests");
hl.add(null, "3 3,. <str> parameter");
hl.add(null, "2 3,. changelog perform changelog conversion");
hl.add(null, "3 3,. <str> parameter");
hl.add(null, "2 3,. template perform image templates");
hl.add(null, "3 3,. <str> parameter");
cfgAll.aliasHelps(cfgAlias.aliasType.test, 2, hl);
Expand Down
7 changes: 6 additions & 1 deletion src/net/freertr/user/userTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,12 @@ public cfgAlias doer() {
}
if (a.equals("tester")) {
userTester t = new userTester();
t.doer(cmd);
t.doTesting(cmd);
return null;
}
if (a.equals("changelog")) {
userTester t = new userTester();
t.doChanges(cmd);
return null;
}
if (a.equals("template")) {
Expand Down
172 changes: 162 additions & 10 deletions src/net/freertr/user/userTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.freertr.util.logger;
import net.freertr.util.shrtPthFrst;
import net.freertr.util.syncInt;
import net.freertr.util.verCore;
import net.freertr.util.version;

/**
Expand All @@ -35,7 +36,6 @@ public class userTester {
*/
public userTester() {
}

/**
* port base
*/
Expand All @@ -46,6 +46,11 @@ public userTester() {
*/
protected final static int portSlot = 100;

/**
* changelog separator
*/
protected final static String chgLogSep = "---------------------------------- ";

private pipeProgress rdr;

private cmds cmd;
Expand Down Expand Up @@ -102,7 +107,9 @@ public userTester() {

private tabIntMatcher chatty;

private String release = "unknown";
private String releaseN = "unknown";

private String releaseV = "unknown";

private int maxTry = 1;

Expand Down Expand Up @@ -137,11 +144,140 @@ public userTester() {
private userTesterOne[] workers;

/**
* do the work
* do the changelog work
*
* @param c command to do
*/
public void doChanges(cmds c) {
cmd = c;
String source = "../changelog.txt";
String target = "";
String state = "";
releaseN = verCore.name;
jvn = "sid";
jvp = "medium";
releaseV = verCore.author;
String startS = "";
boolean forward = true;
int startI = 0;
for (;;) {
String s = cmd.word();
if (s.length() < 1) {
break;
}
if (s.equals("forward")) {
forward = true;
continue;
}
if (s.equals("backward")) {
forward = false;
continue;
}
if (s.equals("source")) {
source = cmd.word();
continue;
}
if (s.equals("packge")) {
releaseN = cmd.word();
continue;
}
if (s.equals("mntner")) {
releaseV = cmd.word().replaceAll("_", " ");
continue;
}
if (s.equals("distro")) {
jvn = cmd.word();
continue;
}
if (s.equals("urgent")) {
jvp = cmd.word();
continue;
}
if (s.equals("target")) {
target = cmd.word();
continue;
}
if (s.equals("state")) {
state = cmd.word();
continue;
}
if (s.equals("since")) {
startS = cmd.word();
continue;
}
}
List<String> lst = bits.txt2buf(state);
if (lst != null) {
startS = lst.get(0);
}
lst = bits.txt2buf(source);
if (lst == null) {
cmd.error("error reading source");
return;
}
List<userTesterChg> res = new ArrayList<userTesterChg>();
userTesterChg cur = new userTesterChg();
for (int i = 0; i < lst.size(); i++) {
String a = lst.get(i);
if (!a.startsWith(chgLogSep)) {
cur.txt.add(a);
continue;
}
cur = new userTesterChg();
a = a.substring(chgLogSep.length(), a.length());
cmds cm = new cmds("hed", a);
a = cm.word() + " ";
a += cm.word();
cur.str = a.replaceAll(" ", "_");
cur.tim = bits.str2time(cfgAll.timeZoneName, a);
a = cm.word();
if (a.length() < 1) {
a = bits.time2str(cfgAll.timeZoneName, cur.tim, 1);
a = a.substring(2, a.length());
a = a.replaceAll("-", ".");
}
cur.ver = a;
if (startS.compareTo(cur.str) >= 0) {
startI = res.size();
}
res.add(cur);
}
lst = new ArrayList<String>();
startI += 1;
if (forward) {
for (int i = startI; i < res.size(); i++) {
dumpOneChange(res.get(i), lst);
}
} else {
for (int i = res.size() - 1; i >= startI; i--) {
dumpOneChange(res.get(i), lst);
}
}
for (int i = 0; i < lst.size(); i++) {
cmd.pipe.linePut(lst.get(i));
}
cur = res.get(res.size() - 1);
bits.buf2txt(true, lst, target);
bits.buf2txt(true, bits.str2lst(cur.str), state);
}

private void dumpOneChange(userTesterChg cur, List<String> lst) {
lst.add(releaseN + " (" + cur.ver + ") " + jvn + "; urgency=" + jvp);
lst.add("");
for (int i = 0; i < cur.txt.size(); i++) {
lst.add(" * " + cur.txt.get(i));
}
lst.add("");
lst.add(" -- " + releaseV + " " + bits.time2str(cfgAll.timeZoneName, cur.tim, 4));
lst.add("");
}

/**
* do the testing work
*
* @param c command to do
*/
public void doer(cmds c) {
public void doTesting(cmds c) {
cmd = c;
rdr = new pipeProgress(cmd.pipe);
int mem = 256;
Expand Down Expand Up @@ -354,8 +490,11 @@ public void doer(cmds c) {
s = "";
}
jvp = jvp.replaceAll("XmxZZZm", s);
userTesterPrc prc = new userTesterPrc(rdr, slot, "version", jvn + jvp + " show version");
release = prc.getLine();
userTesterPrc prc = new userTesterPrc(rdr, slot, "release", jvn + jvp + " show version brief");
releaseN = prc.getLine();
prc.stopNow();
prc = new userTesterPrc(rdr, slot, "version", jvn + jvp + " show version number");
releaseV = prc.getLine();
prc.stopNow();
if (beg.length() < 2) {
beg = "";
Expand Down Expand Up @@ -418,7 +557,8 @@ public void doer(cmds c) {
rdr.debugStat("slot=" + slot);
rdr.debugStat("paralell=" + paralell);
rdr.debugStat("jvm=" + jvn + jvp);
rdr.debugStat("release=" + release);
rdr.debugStat("release=" + releaseN);
rdr.debugStat("version=" + releaseV);
rdr.debugStat("url=" + url);
rdr.debugStat("path=" + path);
rdr.debugStat("discard=" + discard);
Expand Down Expand Up @@ -551,7 +691,7 @@ public void doer(cmds c) {
txt.add(" :active { color: white }");
txt.add("</style>");
txt.add("<title>tester</title></head><body>");
txt.add("release: " + release + "<br/>");
txt.add("release: " + releaseN + "<br/>");
txt.add("tested: " + a + "<br/>");
txt.add("jvm: " + jvn + jvp + "<br/>");
txt.add("<br/>");
Expand All @@ -561,7 +701,7 @@ public void doer(cmds c) {
bits.buf2txt(true, txt, "rtr" + beg + ".html");
txt = new ArrayList<String>();
txt.add("url;file;result;test");
txt.add("-;-;-;" + release);
txt.add("-;-;-;" + releaseN);
txt.add("-;-;-;" + a);
txt.add("-;-;-;" + jvn + jvp);
txt.addAll(features2list(finished, 4));
Expand All @@ -576,7 +716,7 @@ public void doer(cmds c) {
if (txt.size() < 1) {
return;
}
txt.add(0, "---------------------------------- " + bits.time2str(cfgAll.timeZoneName, started + cfgAll.timeServerOffset, 3));
txt.add(0, chgLogSep + bits.time2str(cfgAll.timeZoneName, started + cfgAll.timeServerOffset, 3) + " " + releaseV);
bits.buf2txt(false, txt, "../changelog" + beg + ".txt");
}

Expand Down Expand Up @@ -701,6 +841,18 @@ private static List<String> features2list(tabGen<userTesterFtr> ftr, int mod) {

}

class userTesterChg {

public String str;

public String ver;

public long tim;

public List<String> txt = new ArrayList<String>();

}

class userTesterWrk implements Runnable {

public int slot;
Expand Down
2 changes: 1 addition & 1 deletion src/rtr.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
url;file;result;test
-;-;-;freeRouter v22.3.30-cur, done by cs@nop.
-;-;-;2022-03-30 05:48:05, took 00:07:56, with 80 workers, on 2780 cases, 0 failed, 0 traces, 0 retries
-;-;-;2022-03-30 07:11:22, took 00:08:34, with 80 workers, on 2780 cases, 0 failed, 0 traces, 3 retries
-;-;-;./rtr.bin
http://sources.freertr.net/cfg/basic.tst;basic.tst;success;dummy test
http://sources.freertr.net/cfg/conn-amt01.tst;conn-amt01.tst;success;amt over ipv4
Expand Down
1 change: 0 additions & 1 deletion src/rtr.ftr
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,6 @@ qc pass: socks4 server
qc pass: socks5 server
qc pass: tacacs server
qc pass: udp forwarder server
todo: lsrp pvrp forbid remote dynamic metric
todo: aliases with sticky parameters
todo: disableable door code in temper
todo: changelog converter with start point
Expand Down
2 changes: 1 addition & 1 deletion src/rtr.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</style>
<title>tester</title></head><body>
release: freeRouter v22.3.30-cur, done by cs@nop.<br/>
tested: 2022-03-30 05:48:05, took 00:07:56, with 80 workers, on 2780 cases, 0 failed, 0 traces, 0 retries<br/>
tested: 2022-03-30 07:11:22, took 00:08:34, with 80 workers, on 2780 cases, 0 failed, 0 traces, 3 retries<br/>
jvm: ./rtr.bin<br/>
<br/>
<table><thead><tr><td><b>file</b></td><td><b>result</b></td><td><b>test</b></td></tr></thead><tbody>
Expand Down
1 change: 0 additions & 1 deletion todo.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
lsrp pvrp forbid remote dynamic metric
aliases with sticky parameters
disableable door code in temper
changelog converter with start point
Expand Down

0 comments on commit ddc19c5

Please sign in to comment.