test-day-4

一周的尾声

原定我来做release流程的

后来只是上手了lockbox-v2这个模块的步骤

操作起来就发现了相当多的事情可以尝试自动化

详细的内容倒是写在办公室电脑上了,后面再贴过来吧

下周想要试试用node访问eadp wiki page

以及在下一个change的时候从头开始负责流程

还有Fastrun Daily再继续跟一跟看一看,更新一些

下班之后搭好了 1-Box 和 vpn

不过我还是想要在周末好好休息一下

其实还是挺迷茫的

test-day-3

困扰我的四个Jenkins Job似乎都解决了

component_audit 出故障的原因也许是Jenkins master并不能访问到 p4 对应的artifactory.citools.ea.com

因此无法获取dumb-librarian相关的maven插件

我也没法做什么,Yanqin Cheng也许是解决了

今天更新了FastRun Daily Tracker

也许会对后续的debug有帮助吧

尤其是那种奇奇怪怪的,All Blue but Failed的Run

明天也来继续更新看看

下午开例会还是挺紧张的,而且其实全程并不懂在说些什么

明天开始要自己上手做release的image build了,有点刺激的

先从熟悉不同项目之间的关系开始吧

另外在本地也配置了一份 One Box 虚拟机,看起来像是在虚拟机里跑了Docker

晚上心痒想写代码

不然就这样一直菜下去了

test-day-2

第三天的心情稍微有点糟

自己常用的机场流量超了,suspended

wsl里的Ubuntu也无法访问启动目录

linux下在网页端又无法加载出笔记列表(大概实在是太多了吧

于是更新博客的计划自然而然也就没有做成功

结果一整天下来还是搞不明白测试流程

wiki文档和Jenkins Job报错信息倒是看了好久

但是对于解决问题也没有什么额外的帮助

因为一整天都很头疼,没有推进什么成果

晚上Kyle来问进度的时候都支支吾吾的

还是应该少浪费一些时间,如果看了一段时间也搞不明白的话,随时可以问其他人的

想把四个jobs failed的原因都弄明白,还剩下三个

component_audit失败的原因可能是和maven dumb-librarian 有关

今天翻了翻文档,有可能是pom.xml里面的repository设置有点问题

但我并不清楚具体是哪个目录下的pom.xml

更加详细的具体原因并不清楚,问了Kyle等回复吧

另外两个code_merge 和 code_recut 的原因并不清楚

明天早上仔细整理一下问题详情,去问问他们吧

除了挂掉的原因之外,还想知道如何判断迁移成功过来

同样的参数设置为何会导致结果的差异

另外我在Jenkins服务器上根本没法找到所有项目的源码

新建测试分支是不知道在哪里做的

测试流程方面,问了钟璐,原本先想知道一个宏观具体的测试流程,再一步步细化到我要做什么

因为我真的不知道自己的job description到底是需要做啥

功能测试?性能测试?自动化测试?

先从玩明白了网页戳戳乐开始吧

Jenkins上的这些job本身就是

然后具体的操作演示极其快,实在太多太细,记不清楚

而且我根本不知道为什么要这么做

明天再问问吧,需要每一步都具体地理解清楚了

看一遍和自己做一遍是完全不同的

如果wiki上没有更具体的操作手册,也许我也可以自己再整理一份

这样才能知道人工执行的部分,知道人工的部分之后才能继续自动化

摸鱼的时候,看了看Fastrun portal的源码,顺手装了个node来npm install了一下

里面写的好漂亮,我也想写出这样的代码,不知道还要修炼多久

不过现在的本职毕竟还是测试,前端的东西晚上回家再学

不知不觉晚上又坐到了快7点,好在今天到家精力比昨天更充沛一些

回家之后在X470-RisingSun上简单配置了下开发环境,可以继续更新博客了

文章非常、非常、非常少,以后会慢慢变多的吧

test-day-0

第一天去上班

第一天骑车去上班

早上一路上出了很多汗

也容易迷路 看了好多次导航

但吹吹风还是很开心

大致认识了下组里的人们

配置了下账号

跟着EADP wiki上的 New Hire Setup 和 One Box Setup 搭了一整天环境

看了好久文档

心里可紧张了

每周四会有例会

中午吃饭的时候和 Yubo Li 交流了先前的经历与未来的打算

自己要学的东西实在是有太多太多

下午实在是撑不住 迷迷糊糊睡了10分钟左右吧

毕竟前一晚完全没有睡着

全靠咖啡硬撑了一天

明天就会好很多吧

git clone nucleus 源码的时候花了相当长的时间,拖到了晚上7点还不见它完成,于是就让他挂在那里直接回家了

不明白的事情还有许多,每天记下来吧

多问问总是有帮助的

test-day-1

每天总有一种事情做不完的感觉

今天刚来先配置了下One Box

VM设置好了,后面还需要提交一个merge request再进行下一步

和钟璐一起check了下运行的情况和版本号记录

摸了摸jenkins的pipeline迁移

把p4上的四个item,根据Configuration照葫芦画瓢在test-infra的Jenkins上分别创建了对应的item

Build failed两个

Audit_tools是因为测试用的git版本号并不存在对应的分支,

另一个component_audit是因为我事先并不知情某个目录名的设置需要更改

顺便就复习了下git和eci的分支命名规范

明天再和她确认下具体流程 尤其是release部分 Kyle说过要特别关注

还想看Fastrun的前端源码

下午和James Qian一起创建了Fastrun Daily,用于记录fastrun上一些随机的bug,目的是为了改善fastrun

需要关注非develop标注的运行错误,打开debug开关,根据报错的信息追踪Jenkins上的console log

如果是timeout就不用特别关注,permission denied应该也不必吧

如果是test failed也不用特别详细去看,记录下test即可

如果是maven build failure也不用,大概率是代码本身的问题

error要看最早的那个,并不一定会有“ERROR”字样的提示

先熟悉工作的流程

然后想办法搞个自动化

今晚想要继续更新自己的博客

到家的精力倒是比昨天好一些

Pintos-Project-0

Get the things real

I was too young & too simple last year, thinking just install bochs via system default package manager will work.

Make sure install the exact same version of bochs-2.6.2, and compile it from source code.

Folowing the setup guides HERE to compile bochs-2.6.2 with source code on SourceForge.

On Fedora, packages such as libX11-devel, libXrandr-devel and ncurses-devel are needed.

PC Bootstrap

bootstrapping: process of loading OS into MEM

helpers:
1. BIOS
2. booloader

power on -> BIOS -> BL -> OS

BIOS tests Hardware and finds bootable Devices

IA32: fits within 512B in MEM for partition 436Bytes for MBR

Low Memory: 0x00000000 to 0x000A0000, 640KB

VGA Display: 0x000A0000 to 0x000C0000, 768KB

16-bit devices: 0x000C0000 to 0x000F0000, 960KB

BIOS ROM: 0x000F0000 to 0x00100000, 1MB

Extended Memory & 32-bit memory mapped devices: 0x00100000 to 0xFFFFFFFF, 4GB

The Boot Loader

sector: the disk’s minimum transfer granularity for Read or Write operations

boot sector: the first sector of a bootable disk

BIOS finds a bootable HD

-> load 512B boot sector into MEM at 0x7c00 through 0x7dff

-> set CS:IP to 0000:7c00

CS: Code Segment Register

IP: Instructor Pointer

SS: Stack Segment

DS: Data Segent

ES: moving data around

IA32 Bootloaders runs in real-addressing mode

CS are used to compute the addresses of memory accesses

1
address = 16 * segment + offset

Each segment is 64KB.

The kernel is 512KB, 1024 sectors, must be loaded into memory starting at 0x20000.

The loader reads no more than 512KB. More data than this will cross into other regions for BIOS and Hardware.

The Kernel

The BL transfers contorl to the kernel’s entry point.

The start() in threads/start.S switches the CPU from ‘legacy mode’ to ‘protected mode’.

A20 line: the CPU’s address line numbered 20.
enable it to access more memory than the first 1MB.

Debugging

1. Use GDB to trace the QEMU BIOS

run pintos like:

1
pintos --gdb -- run mytest

then run this in another terminal:

1
pintos-gdb kernel.o

in Pintos-GDB, run this to connect it to the pintos running:

1
target remote localhost:1234

use c to continue til the end, use si to run one step
use b to set breakpoints, like b *0x7c00.

1.1 What is the first instruction that gets executed?

1
2
[f000:fff0]    0xffff0:	ljmp   $0x3630,$0xf000e05b
0x0000fff0 in ?? ()

ljmp: transfer execution control to a different point in the instruction stream.

1.2 At which physical address is this instruction located?

This instruction is located in 0x0000fff0.

1.3 Can you guess why the first instruction is like this?

Maybe it was trying to find the initial point for bootloader.

1.4 What are the next three instructions?

1
2
3
4
5
6
7
8
[f000:e05b]    0xfe05b:	cmpw   $0xffc8,%cs:(%esi)
0x0000e05b in ?? ()

[f000:e062] 0xfe062: jne 0xd241d08c
0x0000e062 in ?? ()

[f000:e066] 0xfe066: xor %edx,%edx
0x0000e066 in ?? ()

Tracing Pintos Bootloader

2.1 How does the bootloader read disk sectors? In particular, waht BIOS interrupt is used?

2.2 How does the bootloader decides whether it finds the Pintos kernel?

2.3 What happens when the bootloader could not find the Pintos kernel?

2.4 At what point does the bootloader transfer control to the Pintos kernel?

my-vim-setup

简单的设置

set nu
syntax on
set showmode
set showcmd
set expandtab
set softtabstop=2
set tabstop=2

插件

Vundle
CScope
NERDTree

如何注释?

CTRL-V 进入 Visual Block 模式

选中代码块,I

插入注释符号,// or # etc.

ESC

Algorithm-Assignment2-Deque&RandomizedQueue

Specification

The concept was easy.

Deque: Queue with support for Adding/Removing items from either the front or the end.

Randomized Queue: Pop random item when Deque.

Deque.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import edu.princeton.cs.algs4.StdOut;

import java.util.Iterator;
import java.util.NoSuchElementException;

public class Deque<Item> implements Iterable<Item> {
private Node first;
private Node last;
private int size;

private class Node {
Item item;
Node previous;
Node next;
}

public Deque() {
first = null;
last = null;
size = 0;
}

public boolean isEmpty() {
return (first == null && last == null);
}

public int size() {
return this.size;
}

public void addFirst(Item item) {
if (item == null)
throw new IllegalArgumentException();
Node oldFirst = first;
first = new Node();
first.item = item;
first.previous = null;
first.next = oldFirst;
if (oldFirst == null && last == null) last = first;
else {
oldFirst.previous = first;
}
size++;
}

public void addLast(Item item) {
if (item == null)
throw new IllegalArgumentException();
Node oldLast = last;
last = new Node();
last.item = item;
last.next = null;
if (first == null && oldLast == null) first = last;
else {
oldLast.next = last;
last.previous = oldLast;
}
size++;
}

public Item removeFirst() {
if (first == null)
throw new NoSuchElementException();
Item item = first.item;
first = first.next;
if (first == null) last = null;
else {
first.previous = null;
}
size--;
return item;
}

public Item removeLast() {
if (last == null)
throw new NoSuchElementException();
Item item = last.item;
last = last.previous;
if (last == null) first = null;
else last.next = null;
if (isEmpty()) first = null;
size--;
return item;
}

public Iterator<Item> iterator() {
return new DequeIterator();
}

private class DequeIterator implements Iterator<Item> {
private Node current = first;

@Override
public boolean hasNext() {
return current != null;
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}

@Override
public Item next() {
if (current == null) {
throw new NoSuchElementException();
}
Item item = current.item;
current = current.next;
return item;
}

}

public static void main(String[] args) {
Deque<Integer> deque = new Deque<>();
StdOut.println("DequeIsEmpty: " + deque.isEmpty());
StdOut.println("Deque's Size: " + deque.size());

Integer a = 1;
deque.addFirst(1);
deque.addFirst(2);
deque.removeFirst();

deque.addLast(1);
deque.addLast(2);
deque.removeFirst();

deque.addFirst(1);
deque.removeFirst();

deque.addLast(1);
deque.addFirst(a);
a++;
deque.addLast(a);
for (Integer i = 1; i < 10; i++) {
deque.addFirst(i);
}

Iterator<Integer> it = deque.iterator();
while (it.hasNext()) {
Integer i = it.next();
StdOut.println("it: " + i);
}

StdOut.println("Size: " + deque.size());
StdOut.println("Remove First: " + deque.removeFirst());
StdOut.println("Remove Last: " + deque.removeLast());
StdOut.println("Size: " + deque.size());
}

}

RandomizedQueue.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;

import java.util.Iterator;
import java.util.NoSuchElementException;

public class RandomizedQueue<Item> implements Iterable<Item> {
private Node first;
private Node last;
private int size;

// construct an empty randomized queue
public RandomizedQueue() {
first = null;
last = null;
size = 0;
}

private class Node {
Item item;
Node prev;
Node next;
}
// is the randomized queue empty?
public boolean isEmpty() {
return (first == null && last == null);
}

// return the number of items on the randomized queue
public int size() {
return this.size;
}

// add the item
public void enqueue(Item item) {
if (item == null) {
throw new IllegalArgumentException();
}
Node oldLast = last;
last = new Node();
last.item = item;
last.next = null;
if (first == null && oldLast == null) first = last;
else {
oldLast.next = last;
last.prev = oldLast;
}
size++;
}

// remove and return a random item
public Item dequeue() {
Item item;
int id = StdRandom.uniform(size);
Node current = first;
if (current == null) {
throw new NoSuchElementException();
}

for (int i = 0; i < id; i++) {
if (current.next != null)
current = current.next;
}

item = current.item;
// Remove current

Node toDelete = current;
if (current == first && first.next == null) {
first = null;
last = null;
} else if (current == first) {
current = current.next;
first = first.next;
first.prev = null;
} else {
current = current.prev;
if (toDelete.next == null) {
current.next = null;
} else {
current.next = toDelete.next;
current.next.prev = toDelete.prev;
}
}

size--;
return item;
}

// return a random item (but do not remove it)
public Item sample() {
Item item;
int id = StdRandom.uniform(size);
Node current = first;
if (current == null) {
throw new NoSuchElementException();
}

for (int i = 0; i < id; i++) {
current = current.next;
}
item = current.item;
return item;
}

// return an independent iterator over items in random order
public Iterator<Item> iterator() {
return new RandomizedQueueIterator();
}

private class RandomizedQueueIterator implements Iterator<Item> {
private Node current = first;

@Override
public boolean hasNext() {
return current != null;
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}

@Override
public Item next() {
if (current == null) {
throw new NoSuchElementException();
}

Item item = current.item;
current = current.next;
return item;
}
}
// unit testing (required)
public static void main(String[] args) {
RandomizedQueue<Integer> rq = new RandomizedQueue<>();
StdOut.println("RandomizedQueue is Empty: " + rq.isEmpty());
StdOut.println("size: " + rq.size());

rq.enqueue(283);
StdOut.println(rq.sample());

rq.enqueue(119);

StdOut.println(rq.dequeue());
StdOut.println(rq.dequeue());

for (Integer i = 0; i < 5; i++){
rq.enqueue(i);
}

StdOut.println("size after enqueue: " + rq.size());
StdOut.println("Deque: " + rq.dequeue());
StdOut.println("Sample: " + rq.sample());

Iterator<Integer> jt = rq.iterator();
while (jt.hasNext()) {
Integer i = jt.next();
StdOut.println("it: " + i);
}

}
}

Algorithm-Assignment1-Percolation

Specification

Trying to do Algortihm Course Assignments.
Finished it long time ago.
So I don’t remember too much about the details.

Percolation.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import edu.princeton.cs.algs4.WeightedQuickUnionUF;

public class Percolation {
private boolean[] open;
private int openSites;
private final int size;
private final WeightedQuickUnionUF wquf;

// create n-by-n grid, with all sites blocked
public Percolation(int n) {
if (n <= 0)throw new java.lang.IllegalArgumentException();
this.size = n;
this.openSites = 0;
this.open = new boolean[n*n];
this.wquf = new WeightedQuickUnionUF(n*n + 2);
}

private int map2dTo1d(int row, int col) {
return (row - 1) * size + col;
}

private boolean indicesValid(int row, int col) {
return (row > 0 && row <= size && col > 0 && col <= size);
}

// open site (row, col) if it is not open already
public void open(int row, int col) {
if (!indicesValid(row, col)) throw new java.lang.IllegalArgumentException();
int index = map2dTo1d(row, col);
if (row == 1) {
wquf.union(0, index);
open[index-1] = true;
} else if (row == size) {
wquf.union(size * size + 1, index);
open[index-1] = true;
}

int left = col-1;
int right = col+1;
int up = row-1;
int down = row+1;

if (indicesValid(row, left) && isOpen(row, left)) {
wquf.union(index - 1, index);
open[index-1] = true;
}

if (indicesValid(row, right) && isOpen(row, right)) {
wquf.union(index + 1, index);
open[index-1] = true;
}

if (indicesValid(up, col) && isOpen(up, col)) {
wquf.union(index - size, index);
open[index-1] = true;
}

if (indicesValid(down, col) && isOpen(down, col)) {
wquf.union(index + size, index);
open[index-1] = true;
}

if (indicesValid(row, col)) {
open[index-1] = true;
openSites++;
}

}

// is site (row, col) open?
public boolean isOpen(int row, int col) {
if (!indicesValid(row, col))
throw new java.lang.IllegalArgumentException();
return open[(row - 1) * size + col -1];
}

// is site (row, col) full?
public boolean isFull(int row, int col) {
if (!indicesValid(row, col))
throw new java.lang.IllegalArgumentException();
return wquf.connected((row - 1) * size + col, 0);
}

// number of open sites
public int numberOfOpenSites() {
return openSites;
}

// does the system percolate?
public boolean percolates() {
return wquf.connected(0, size * size + 1);
}

// test client (optional)
// public static void main(String[] args) {
//
// }
}

PercolationStats.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
import edu.princeton.cs.algs4.StdStats;

public class PercolationStats {
private static final double CONFIDENCE_95 = 1.96;
private final int trials;
private final double mean;
private final double stddev;
public PercolationStats(int n, int trials) {
if (n <= 0 || trials <= 0)throw new java.lang.IllegalArgumentException();
this.trials = trials;
double[] results = new double[trials];
for (int i = 0; i < trials; i++) {
Percolation p = new Percolation(n);
double count = 0;
while (!p.percolates()) {
count++;
int row = StdRandom.uniform(1, n + 1);
int col = StdRandom.uniform(1, n + 1);
while (p.isOpen(row, col)) {
row = StdRandom.uniform(1, n + 1);
col = StdRandom.uniform(1, n + 1);
}
p.open(row, col);
}
results[i] = count / (n * n);
}
this.mean = StdStats.mean(results);
this.stddev = StdStats.stddev(results);
}
public double mean() {
return this.mean;
}
public double stddev() {
return this.stddev;
}
public double confidenceLo() {
return mean() - CONFIDENCE_95 * stddev() / Math.sqrt(trials);
}
public double confidenceHi() {
return mean() + CONFIDENCE_95 * stddev() / Math.sqrt(trials);
}
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
int t = Integer.parseInt(args[1]);
PercolationStats ps = new PercolationStats(n, t);
// StdOut.print(ps.mean());
// StdOut.print(ps.stddev());
// StdOut.print(ps.confidenceLo());
// StdOut.print(ps.confidenceHi());
StdOut.println("mean = " + ps.mean());
StdOut.println("stddev = " + ps.stddev());
StdOut.println("95% confidence interval = [" + ps.confidenceLo() + ", " + ps.confidenceHi() + "]");

}
}

pintos初探

Installation

Official Instruction

Install Dependencies

Check this Installing Pintos.

We don’t want to install Bochs.

We are going to run pintos with QEMU.

Fix undefined reference to ‘floor’

1
2
3
4
5
setitimer-helper.o: In function `main':
setitimer-helper.c:(.text+0xcb): undefined refernce to `floor'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'setitimer-helper' failed
make *** [setitimer-helper] Error 1

utils/Makefile

Line 5:

1
LDFLAGS = -lm

Change LDFLAGS to LDLIBS

Fix $^V problem

1
Unrecognized character \x16; marked by <-- HERE after if ($<-- HERE near column 7 at ~/code/pintos/src/utils/pintos line 911.

utils/pintos

Line 911:

1
if ($^V ge 5.8.0)

Delete $^V and type it again.

Fix SIGVTALRM problem

1
2
3
Prototype mismatch: sub main::SIGVTALRM () vs none at /usr/bin/pintos line 949.

Constant subroutine SIGVTALRM redefined at /usr/bin/pintos line 941.

utils/pintos

Line 930:

Comment out the whole SIGVTALRM function.

Modifing files to run with QEMU

1
2
squish-pty bochs -q
exec: No such file or directory

threads/Make.vars

Line 7:

1
SIMULATOR = --bochs

Change bochs to qemu

utils/pintos

Line 103:

1
$sim = "bochs" if !defined $sim;

Change bochs to qemu

Line 259:

1
my $name = find_file ('kernel.bin');

Change kernel.bin to the explicit location of kernel.bin in $ProjectFolder/threads/build/

e.g. /home/parallels/Project/pintos/src/threads/build/kernel.bin

utils/Pintos.pm

Line 362:

1
$name = find_file ("loader.bin") if !defined $name;

Change loader.bin to the explicit location of loader.bin in $ProjectFolder/threads/build/

e.g. /home/parallels/Project/pintos/src/threads/build/loader.bin

BOOTLOOP

cannot find memory?

cannot print init_ram_page in init.c

finnally find it impossible to work on PD with qemu due to PD’s lack of vmx support

so either changing to bochs or running ubuntu in VMware

damn fuck

why not trying to run pintos simulator on macOS ?

Unix-like with VT-x support

maybe i should just follow the guide provided by JHU or SJTU ?