Skip to content
Snippets Groups Projects

HUST codebase improvement suggestions

Closed Recolic requested to merge public-template into origin-hust-version
9 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
6 !.gitignore
7 !init.sh
1 *.yy.cc
2 *.tab.cc
3 *.tab.h
4
5 *.d
6 *.o
7 *.out
8 *.output
9
10 build
11
12 .idea
13 .vscode
14 nemu/*.txt
  • Author Owner

    将gitignore从白名单改为黑名单模式。子目录有大量没用的gitignore,我没有删掉,老师可以考虑也删掉它们。

  • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • .gitlab-ci.yml 0 → 100644
    10 - pacman -Sy && pacman -S --noconfirm gcc make bison flex gettext sdl2 lib32-glibc grep
    11 - export AM_HOME=$(pwd)/nexus-am/
    12 - cd nemu && make EXTRA_FLAGS='-DDISABLE_MMIO'
    13 - show_log=1 ./runall.sh &> testcases.log ; echo $? > testres.log
    14 artifacts:
    15 paths:
    16 - nemu/testres.log
    17 - nemu/testcases.log
    18 expire_in: 1 week
    19
    20 test:
    21 stage: test
    22 script:
    23 - test 0 = $(<nemu/testres.log) || cat nemu/testcases.log
    24 - test 0 = $(<nemu/testres.log)
    25
    • Author Owner

      这是一个模板CI配置,少数对CI感兴趣的学生可以用得到,对其他学生也是无害的。(这是一个隐藏文件)

    • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • 16 16 .DEFAULT_GOAL = app
    17 17
    18 18 # Compilation flags
    19 CC = gcc
    20 LD = gcc
    19 CC ?= gcc
    20 LD = $(CC)
  • Recolic
    Recolic @root started a thread on the diff
  • 30 31 $(OBJ_DIR)/%.o: src/%.c
    31 32 @echo + CC $<
    32 33 @mkdir -p $(dir $@)
    33 @$(CC) $(CFLAGS) $(SO_CFLAGS) -c -o $@ $<
    34 $(CC) $(CFLAGS) $(SO_CFLAGS) -c -o $@ $<
  • Recolic
    Recolic @root started a thread on the diff
  • 12 15 -@(echo "> $(1)" && echo $(STUID) && id -un && uname -a && uptime && (head -c 20 /dev/urandom | hexdump -v -e '"%02x"') && echo) | git commit -F - $(GITFLAGS)
    13 16 -@sync
    14 17 endef
    18
    19 define git_commit
    20 -@echo Recolic helped you to prevent fucking junks!
    21 endef
    22
    23 git_gen:
    24 ifeq ($(M),)
    25 @echo 'Usage: make git_gen M="Some message"'
    26 @echo ' or: env M="Some message" make git_gen'
    27 else
    28 $(call git_commit_origin, "Manual commit: " $(M))
    29 endif
    30
    • Author Owner

      这里我禁用了每次make自动生成git commit,改为手动make git_gen M="Implement more instructions!",老师可以按需求修改。如果确实有必要,可以不必采纳我的更改。

      Edited by Recolic
    • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • 1 STUID = 171220000
    2 STUNAME = 张三
    1 STUID = U201614531
    2 STUNAME = 刘本嵩
    3 # Set to dssl.cun.io if you're not willing to use Recolic Reverse Proxy Service.
    4 SUBMIT_HOST = cernet.cnm.cool
    • Author Owner

      这个submit_host如果是dssl.cun.io,就表示不用反代。否则,指定他想用的反代的域名。详见setup.sh/submit.sh/recover.sh/父Makefile。

    • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • nemu/runall.sh 100644 → 100755
    31 38 echo -e "\033[1;32mPASS!\033[0m"
    32 rm $logfile
    33 39 else
    34 40 echo -e "\033[1;31mFAIL!\033[0m see $logfile for more information"
    41 has_fail=1
    35 42 if (test -e $ori_log) then
    36 43 echo -e "\n\n===== the original log.txt =====\n" >> $logfile
    37 44 cat $ori_log >> $logfile
    38 45 fi
    46 head -n 512 $logfile >> $g_logfile
    39 47 fi
    48 rm -f $logfile
    40 49 done
    50
    51 [[ $has_fail = 1 ]] && cat $g_logfile
    52 exit $has_fail
    • Author Owner

      这个脚本的作用,请看.gitlab-ci.yml。如果感觉不够完善,可以再作修改。但原来的版本完全不支持显示testcases compile errorNEMU compile error的原因,太难受了。

    • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • 6 11 [ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit
    7 12 [ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit
    8 13 echo "uploading public key..."
    9 curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" https://dssl.cun.io/teach/api/uploads/pasetup
    10 sleep 2
    14 echo curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup"
    15 curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup" -v ||
    16 (echo 'ERROR: Upload failed. Recolic proxy server is in HongKong and it"s slow, so you may try again.' ; exit 2)
    17 sleep 5
    • Author Owner

      curl一定要检查是否成功。后面那些命令因为较少失败,我就没加检查。但反代用户curl经常失败,这个很有必要。(老师可以改一下报错信息,Unable to upload to $hust_submit_server_host之类的)

      Edited by Recolic
    • Please register or sign in to reply
  • Recolic
    Recolic @root started a thread on the diff
  • 6 11 [ -z ${STUID} ] && echo "STUID must be set (RTFM)" && exit
    7 12 [ -z ${STUNAME} ] && echo "STUNAME must be set (RTFM)" && exit
    8 13 echo "uploading public key..."
    9 curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" https://dssl.cun.io/teach/api/uploads/pasetup
    10 sleep 2
    14 echo curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup"
    15 curl -F "id=${STUID}" -F "name=${STUNAME}" -F "file=@${HOME}/.ssh/id_rsa.pub" "https://$hust_submit_server_host/teach/api/uploads/pasetup" -v ||
    16 (echo 'ERROR: Upload failed. Recolic proxy server is in HongKong and it"s slow, so you may try again.' ; exit 2)
    17 sleep 5
    11 18 echo "recover from remote git..."
    12 git remote add hustpa pa@dssl.cun.io:${STUID}-git
    19 git remote add hustpa "pa@$hust_submit_server_host:${STUID}-git"
  • closed

  • Please register or sign in to reply
    Loading