mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-10-03 21:37:39 +03:00
Misc cleanup blocking CC-Release. (#1249)
* Move extraneous stuff out of pkg/urbit/* * s/urb/herb/g * Removed some boilerplate for `urbit` builds. * Build urbit tests and run them in the nix build.
This commit is contained in:
parent
62e7c8272b
commit
3c3f7e761e
4
Makefile
4
Makefile
@ -5,13 +5,13 @@ PKGS = minima extrema rusthello prog
|
||||
.PHONY: build build-all install release test clean
|
||||
|
||||
build:
|
||||
nix-build -A urbit -A urb --no-out-link
|
||||
nix-build -A urbit -A herb --no-out-link
|
||||
|
||||
build-all:
|
||||
nix-build --no-out-link
|
||||
|
||||
install:
|
||||
nix-env -f . -iA urbit -iA urbit-debug -iA urb
|
||||
nix-env -f . -iA urbit -iA urbit-debug -iA herb
|
||||
|
||||
release:
|
||||
sh/release urbit linux32
|
||||
|
@ -15,13 +15,13 @@ cleanup () {
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
urb ./zod -p hood -d '+hood/autoload |'
|
||||
urb ./zod -p hood -d "+hood/mount %"
|
||||
herb ./zod -p hood -d '+hood/autoload |'
|
||||
herb ./zod -p hood -d "+hood/mount %"
|
||||
|
||||
rm -r ./zod/home
|
||||
cp -r $ARVO ./zod/home
|
||||
|
||||
urb ./zod -p hood -d "+hood/commit %home"
|
||||
urb ./zod -P brass.pill -d '+brass'
|
||||
herb ./zod -p hood -d "+hood/commit %home"
|
||||
herb ./zod -P brass.pill -d '+brass'
|
||||
|
||||
mv brass.pill $out
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "brass";
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
|
||||
buildInputs = [ urbit tlon.herb pkgs.coreutils ];
|
||||
|
||||
FAKEZOD = fakezod;
|
||||
ARVO = arvo;
|
||||
|
@ -5,13 +5,13 @@ set -ex
|
||||
urbit -d -F $SHIP -B "$PILL" $out
|
||||
|
||||
check () {
|
||||
[ 3 -eq "$(urb $out -d 3)" ]
|
||||
[ 3 -eq "$(herb $out -d 3)" ]
|
||||
}
|
||||
|
||||
if check
|
||||
then
|
||||
echo "Boot success." >&2
|
||||
urb $out -p hood -d '+hood/exit' || true
|
||||
herb $out -p hood -d '+hood/exit' || true
|
||||
else
|
||||
echo "Boot failure." >&2
|
||||
kill $(< $out/.vere.lock) || true
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "fake" + ship;
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [ urbit tlon.urb ];
|
||||
buildInputs = [ urbit tlon.herb ];
|
||||
PILL = brass;
|
||||
SHIP = ship;
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ cleanup () {
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
urb ./zod -p hood -d '+hood/autoload |'
|
||||
urb ./zod -p hood -d "+hood/mount %"
|
||||
herb ./zod -p hood -d '+hood/autoload |'
|
||||
herb ./zod -p hood -d "+hood/mount %"
|
||||
|
||||
rm -r ./zod/home
|
||||
cp -r $ARVO ./zod/home
|
||||
@ -25,7 +25,7 @@ cp -r $ARVO ./zod/home
|
||||
# cp $ARVO/gen/solid.hoon ./zod/home/gen/
|
||||
# cp $ARVO/lib/pill.hoon ./zod/home/lib/
|
||||
|
||||
urb ./zod -p hood -d "+hood/commit %home"
|
||||
urb ./zod -P urbit.pill -d '+solid, =dub &'
|
||||
herb ./zod -p hood -d "+hood/commit %home"
|
||||
herb ./zod -P urbit.pill -d '+solid, =dub &'
|
||||
|
||||
mv urbit.pill $out
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "solid";
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
|
||||
buildInputs = [ urbit tlon.herb pkgs.coreutils ];
|
||||
|
||||
FAKEZOD = fakezod;
|
||||
ARVO = arvo;
|
||||
|
@ -20,29 +20,29 @@ shutdown () {
|
||||
|
||||
trap shutdown EXIT
|
||||
|
||||
urb ./ship -p hood -d '+hood/autoload |'
|
||||
urb ./ship -p hood -d '+hood/mount %'
|
||||
herb ./ship -p hood -d '+hood/autoload |'
|
||||
herb ./ship -p hood -d '+hood/mount %'
|
||||
|
||||
rm -r ./ship/home
|
||||
cp -r $ARVO ./ship/home
|
||||
|
||||
urb ./ship -p hood -d '+hood/commit %home'
|
||||
herb ./ship -p hood -d '+hood/commit %home'
|
||||
|
||||
# Start the test app
|
||||
urb ./ship -p hood -d '+hood/start %test'
|
||||
herb ./ship -p hood -d '+hood/start %test'
|
||||
|
||||
# Run the %cores tests
|
||||
urb ./ship -d '~& ~ ~& %start-test-cores ~'
|
||||
urb ./ship -p test -d ':- %cores /'
|
||||
urb ./ship -d '~& %finish-test-cores ~'
|
||||
herb ./ship -d '~& ~ ~& %start-test-cores ~'
|
||||
herb ./ship -p test -d ':- %cores /'
|
||||
herb ./ship -d '~& %finish-test-cores ~'
|
||||
|
||||
# Run the %renders tests
|
||||
urb ./ship -d '~& ~ ~& %start-test-renders ~'
|
||||
urb ./ship -p test -d ':- %renders /'
|
||||
urb ./ship -d '~& %finish-test-renders ~'
|
||||
herb ./ship -d '~& ~ ~& %start-test-renders ~'
|
||||
herb ./ship -p test -d ':- %renders /'
|
||||
herb ./ship -d '~& %finish-test-renders ~'
|
||||
|
||||
# Run the test generator
|
||||
urb ./ship -d '+test, =seed `@uvI`(shaz %reproducible)' |
|
||||
herb ./ship -d '+test, =seed `@uvI`(shaz %reproducible)' |
|
||||
tee test-generator-output
|
||||
|
||||
shutdown
|
||||
|
@ -3,7 +3,7 @@
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "test";
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [ urbit tlon.urb pkgs.coreutils ];
|
||||
buildInputs = [ urbit tlon.herb pkgs.coreutils ];
|
||||
|
||||
SHIP = ship;
|
||||
ARVO = arvo;
|
||||
|
@ -4,26 +4,20 @@ let
|
||||
|
||||
deps = import ../deps { inherit pkgs; };
|
||||
|
||||
ent = import ./ent { inherit pkgs; };
|
||||
arvo = import ./arvo { inherit pkgs; };
|
||||
herb = import ../../pkg/herb { inherit pkgs; };
|
||||
|
||||
mkUrbit = { debug }:
|
||||
import ./urbit {
|
||||
inherit pkgs ent debug;
|
||||
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
|
||||
inherit (deps) secp256k1 h2o;
|
||||
};
|
||||
|
||||
urbit = mkUrbit { debug=false; };
|
||||
urbit-debug = mkUrbit { debug=true; };
|
||||
|
||||
in
|
||||
|
||||
rec {
|
||||
arvo = import ./arvo { inherit pkgs; };
|
||||
ent = import ./ent { inherit pkgs; };
|
||||
urb = import ../../pkg/urb { inherit pkgs; };
|
||||
|
||||
urbit = import ./urbit {
|
||||
inherit pkgs ent;
|
||||
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
|
||||
inherit (deps) secp256k1 h2o;
|
||||
name = "urbit";
|
||||
debug = false;
|
||||
};
|
||||
|
||||
urbit-debug = import ./urbit {
|
||||
inherit pkgs ent;
|
||||
inherit (deps) argon2 murmur3 uv ed25519 sni scrypt softfloat3;
|
||||
inherit (deps) secp256k1 h2o;
|
||||
name = "urbit-debug";
|
||||
debug = true;
|
||||
};
|
||||
}
|
||||
{ inherit ent arvo herb urbit urbit-debug; }
|
||||
|
@ -6,7 +6,9 @@ cd src
|
||||
|
||||
bash ./configure
|
||||
|
||||
make clean
|
||||
make urbit urbit-worker -j8
|
||||
make test
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp urbit $out/bin/$exename
|
||||
|
@ -1,12 +1,14 @@
|
||||
{
|
||||
pkgs,
|
||||
name ? "urbit",
|
||||
debug ? false,
|
||||
debug,
|
||||
argon2, ed25519, ent, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
name =
|
||||
if debug then "urbit-debug" else "urbit";
|
||||
|
||||
deps =
|
||||
with pkgs;
|
||||
[ curl gmp libsigsegv ncurses openssl zlib ];
|
||||
@ -14,16 +16,6 @@ let
|
||||
vendor =
|
||||
[ argon2 softfloat3 ed25519 ent h2o scrypt uv murmur3 secp256k1 sni ];
|
||||
|
||||
# osx =
|
||||
# with pkgs;
|
||||
# lib.optionals stdenv.isDarwin (
|
||||
# with darwin.apple_sdk.frameworks;
|
||||
# [ Cocoa CoreServices ]);
|
||||
|
||||
# NIX_LDFLAGS =
|
||||
# pkgs.lib.optionalString pkgs.stdenv.isDarwin
|
||||
# "-framework CoreServices -framework CoreFoundation";
|
||||
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
@ -8,6 +8,7 @@ in
|
||||
|
||||
import ./default.nix {
|
||||
inherit pkgs;
|
||||
debug = false;
|
||||
inherit (tlon) ent;
|
||||
inherit (deps)
|
||||
argon2 ed25519 h2o murmur3 scrypt secp256k1 sni softfloat3 uv;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# urb
|
||||
# Herb
|
||||
|
||||
Unix control of Urbit
|
||||
|
||||
@ -7,10 +7,10 @@ Unix control of Urbit
|
||||
To run without installing anything:
|
||||
|
||||
```bash
|
||||
nix-shell --pure --command 'python ./urb -d "(add 3 4)"'
|
||||
nix-shell --pure --command 'python ./herb -d "(add 3 4)"'
|
||||
```
|
||||
|
||||
To install `urb`:
|
||||
To install `herb`:
|
||||
|
||||
```bash
|
||||
nix-env -if .
|
@ -21,19 +21,19 @@ let
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "urb";
|
||||
name = "herb";
|
||||
buildInputs = [ pyenv ];
|
||||
unpackPhase = "true";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
cp ${./urb} $out/bin/urb.py
|
||||
cp ${./herb} $out/bin/herb.py
|
||||
|
||||
cat > $out/bin/urb <<EOF
|
||||
cat > $out/bin/herb <<EOF
|
||||
#!/usr/bin/env bash
|
||||
${pyexe} $out/bin/urb.py "\$@"
|
||||
${pyexe} $out/bin/herb.py "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/urb
|
||||
chmod +x $out/bin/herb
|
||||
'';
|
||||
}
|
2
pkg/urbit/.gitignore
vendored
2
pkg/urbit/.gitignore
vendored
@ -23,3 +23,5 @@ GRTAGS
|
||||
GTAGS
|
||||
*.swo
|
||||
*.swp
|
||||
hash_tests
|
||||
hashtable_tests
|
||||
|
@ -1,62 +0,0 @@
|
||||
dist: xenial
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
|
||||
# Uncomment me if this gets annoying
|
||||
#
|
||||
# notifications:
|
||||
# email: false
|
||||
|
||||
before_install:
|
||||
# try to get pill early, so configuration errors will be quickly caught
|
||||
- cd .travis
|
||||
- bash check-trailing-whitespace.sh
|
||||
- bash get-brass-pill.sh
|
||||
- cd ..
|
||||
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
|
||||
- unzip ninja-linux.zip
|
||||
- sudo mv ninja /usr/bin/
|
||||
|
||||
install:
|
||||
# pwd: ~/urbit
|
||||
- pip3 install --user -I meson
|
||||
|
||||
script:
|
||||
- meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true
|
||||
- cd ./build
|
||||
- ninja
|
||||
- ninja test
|
||||
- sudo ninja install
|
||||
- cd ../.travis
|
||||
- npm install
|
||||
- ulimit -c unlimited -S
|
||||
- npm run -s test; bash print-core-backtrace.sh $?
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-setuptools
|
||||
- python3-wheel
|
||||
- libgmp3-dev
|
||||
- libsigsegv-dev
|
||||
- openssl
|
||||
- libssl-dev
|
||||
- libncurses5-dev
|
||||
- gcc
|
||||
- libcurl4-gnutls-dev
|
||||
- unzip
|
||||
- gdb
|
||||
# before_deploy: "make deb" # TODO
|
||||
# deploy:
|
||||
# skip_cleanup: true
|
||||
# provider: releases
|
||||
# prerelease: true # turn this off for official releases
|
||||
# api_key:
|
||||
# secure: XX
|
||||
# file: ./build/urbit # TODO upload package from before_deploy
|
||||
# on:
|
||||
# repo: urbit/urbit
|
||||
# tags: true
|
2
pkg/urbit/.travis/.gitattributes
vendored
2
pkg/urbit/.travis/.gitattributes
vendored
@ -1,2 +0,0 @@
|
||||
# Don't show in diffs or auto-merge
|
||||
package-lock.json binary
|
1
pkg/urbit/.travis/.gitignore
vendored
1
pkg/urbit/.travis/.gitignore
vendored
@ -1 +0,0 @@
|
||||
node_modules/
|
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
whitespace=$(
|
||||
find .. -path ../.git -prune -o \
|
||||
-path ../subprojects -prune -o \
|
||||
-type f \
|
||||
-exec egrep -l " +$" {} ';' \
|
||||
)
|
||||
|
||||
if [ -n "$whitespace" ]
|
||||
then
|
||||
echo 'found trailing whitespace in:';
|
||||
echo $whitespace;
|
||||
exit 1;
|
||||
fi
|
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
if [ ! -f ./pin-arvo-commit.txt ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f ./pin-brass-pill.txt ]; then
|
||||
echo "missing .travis/pin-brass-pill.txt"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PILL_NAME=$(cat ./pin-brass-pill.txt | tr -d [:space:])
|
||||
|
||||
wget https://bootstrap.urbit.org/$PILL_NAME -O brass.pill && exit 0
|
||||
|
||||
echo "$PILL_NAME download failed"
|
||||
exit 1
|
BIN
pkg/urbit/.travis/package-lock.json
generated
BIN
pkg/urbit/.travis/package-lock.json
generated
Binary file not shown.
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "vere-tests",
|
||||
"version": "1.0.0",
|
||||
"description": "Test harness for the Urbit runtime",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"private": true,
|
||||
"author": "~fyr",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"urbit-runner": "github:urbit/runner-js#ee24550"
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
urbit-0.7.2.brass.pill
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
RESULT=$1
|
||||
|
||||
if [[ ${RESULT} -eq 0 ]]; then
|
||||
exit 0
|
||||
else
|
||||
for i in $(find ./ -maxdepth 1 -name 'core*' -print)
|
||||
do
|
||||
gdb urbit core* -ex "thread apply all bt" -ex "set pagination 0" -batch
|
||||
done
|
||||
fi
|
||||
|
||||
echo "build failed with status code $RESULT"
|
||||
exit $RESULT
|
@ -1,68 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs')
|
||||
var runner = require('urbit-runner')
|
||||
var Urbit = runner.Urbit;
|
||||
var ERROR = runner.ERROR;
|
||||
var actions = runner.actions
|
||||
|
||||
var args =
|
||||
(function() {
|
||||
var commit;
|
||||
|
||||
try {
|
||||
commit = fs.readFileSync('./pin-arvo-commit.txt', 'utf-8');
|
||||
}
|
||||
catch (e) {
|
||||
return ['-cgSF', 'zod', '-B', 'brass.pill', 'zod'];
|
||||
}
|
||||
|
||||
var hash = commit.slice(0, 10);
|
||||
var pill = 'https://bootstrap.urbit.org/git-' + hash + '.pill';
|
||||
return ['-u', pill, '-cgPSF', 'zod', 'zod'];
|
||||
})();
|
||||
|
||||
var urbit = new Urbit(args);
|
||||
|
||||
// vere hangs (always?) with run in travis-ci with -P
|
||||
// so we send ^Z if we hang for ~s30
|
||||
function exit() {
|
||||
setTimeout(function(){
|
||||
urbit.pty.write('\x1a');
|
||||
urbit.pty.on('exit', function(code, signal){
|
||||
process.exit(0);
|
||||
})
|
||||
}, 30 * 1000);
|
||||
|
||||
return urbit.exit(0);
|
||||
}
|
||||
|
||||
Promise.resolve(urbit)
|
||||
// XX temporary
|
||||
// send ctrl-x to select dojo
|
||||
//
|
||||
.then(function(){
|
||||
return urbit.expect(/talk\[\] /)
|
||||
.then(function() {
|
||||
return urbit.pty.write("\x18")
|
||||
})
|
||||
.then(function() { return urbit })
|
||||
})
|
||||
.then(actions.safeBoot)
|
||||
.then(actions.test)
|
||||
.then(function(){
|
||||
return urbit.line("|mass")
|
||||
.then(function(){
|
||||
return urbit.expectEcho("%ran-mass")
|
||||
.then(function(){ return urbit.resetListeners(); })
|
||||
})
|
||||
})
|
||||
.then(exit)
|
||||
.catch(function(err){
|
||||
// we still exit 0, Arvo errors are not our fault ...
|
||||
return urbit.waitSilent()
|
||||
.then(function(){
|
||||
return urbit.warn("Arvo test aborted:", err);
|
||||
})
|
||||
.then(exit);
|
||||
});
|
@ -15,23 +15,36 @@ worker_objs = $(shell echo $(worker) | sed 's/\.c/.o/g')
|
||||
|
||||
all_objs = $(common_objs) $(daemon_objs) $(worker_objs)
|
||||
all_srcs = $(common) $(daemon) $(worker)
|
||||
all_exes = ./hash_tests ./hashtable_tests ./urbit ./urbit-worker
|
||||
|
||||
################################################################################
|
||||
|
||||
.PHONY: all clean mkproper
|
||||
.PHONY: all test clean mkproper
|
||||
|
||||
################################################################################
|
||||
|
||||
all: urbit urbit-worker
|
||||
all: urbit urbit-worker hashtable_tests hash_tests
|
||||
|
||||
test: hashtable_tests hash_tests
|
||||
./hashtable_tests
|
||||
./hash_tests
|
||||
|
||||
clean:
|
||||
rm -f $(all_objs) ./urbit ./urbit-worker ./tags
|
||||
rm -f ./tags $(all_objs) $(all_exes)
|
||||
|
||||
mrproper: clean
|
||||
rm -f config.mk include/config.h
|
||||
|
||||
################################################################################
|
||||
|
||||
hashtable_tests: $(common_objs) tests/hashtable_tests.o
|
||||
@echo CC -o $@
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
hash_tests: $(common_objs) tests/hash_tests.o
|
||||
@echo CC -o $@
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
||||
urbit: $(common_objs) $(daemon_objs)
|
||||
@echo CC -o $@
|
||||
@$(CC) $^ $(LDFLAGS) -o $@
|
||||
|
@ -1,5 +0,0 @@
|
||||
urbit (0.6-0) unstable; urgency=high
|
||||
|
||||
* Memory-allocation bug fix in _box_slot in Vere. Breaking change.
|
||||
|
||||
-- Keaton Dunsford <keaton@tlon.io> Fri, 8 Jun 2018 14:31:08 -0700
|
@ -1 +0,0 @@
|
||||
10
|
@ -1,12 +0,0 @@
|
||||
Source: urbit
|
||||
Section: net
|
||||
Priority: extra
|
||||
Maintainer: Ted Blackman <ted@tlon.io>
|
||||
Build-Depends: debhelper (>= 9), libgmp3-dev, libsigsegv-dev, openssl, libssl-dev,libtool, meson, re2c, libcurl4-gnutls-dev
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: http://urbit.org
|
||||
|
||||
Package: urbit
|
||||
Architecture: any
|
||||
Depends: libgmp3-dev, libsigsegv-dev, openssl, libcurl4-gnutls-dev
|
||||
Description: An operating function
|
@ -1,27 +0,0 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: urbit
|
||||
Source: <http://urbit.org>
|
||||
|
||||
Files: *
|
||||
License: MIT
|
||||
The MIT License (MIT)
|
||||
.
|
||||
Copyright (c) 2017 Urbit
|
||||
.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1 +0,0 @@
|
||||
urbit
|
@ -1,2 +0,0 @@
|
||||
LICENSE.txt
|
||||
README.md
|
@ -1 +0,0 @@
|
||||
bin/urbit usr/bin
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
@ -1 +0,0 @@
|
||||
3.0 (quilt)
|
@ -1,4 +0,0 @@
|
||||
file bin/test_hash
|
||||
handle SIGSEGV nostop noprint
|
||||
start
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
git submodule init
|
||||
git submodule update
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir ./build &> /dev/null
|
||||
meson . ./build --buildtype=release "$@"
|
||||
ninja -C build
|
@ -1,273 +0,0 @@
|
||||
/* w/test.c
|
||||
**
|
||||
*/
|
||||
#define C3_GLOBAL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <gmp.h>
|
||||
#include <dirent.h>
|
||||
#include <stdint.h>
|
||||
#include <uv.h>
|
||||
#include <ncurses/curses.h>
|
||||
#include <termios.h>
|
||||
#include <ncurses/term.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "all.h"
|
||||
|
||||
#if 1
|
||||
/* u3_walk_load(): load file or bail.
|
||||
*/
|
||||
static u3_noun
|
||||
u3_walk_load(c3_c* pas_c)
|
||||
{
|
||||
struct stat buf_b;
|
||||
c3_i fid_i = open(pas_c, O_RDONLY, 0644);
|
||||
c3_w fln_w, red_w;
|
||||
c3_y* pad_y;
|
||||
|
||||
if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) {
|
||||
fprintf(stderr, "%s: %s\r\n", pas_c, strerror(errno));
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
fln_w = buf_b.st_size;
|
||||
pad_y = c3_malloc(buf_b.st_size);
|
||||
|
||||
red_w = read(fid_i, pad_y, fln_w);
|
||||
close(fid_i);
|
||||
|
||||
if ( fln_w != red_w ) {
|
||||
free(pad_y);
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y);
|
||||
free(pad_y);
|
||||
|
||||
return pad;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static c3_w*
|
||||
_test_walloc(c3_w siz_w)
|
||||
{
|
||||
c3_w *ptr_w = u3a_walloc(siz_w);
|
||||
c3_w i_w;
|
||||
|
||||
c3_assert(siz_w >= 1);
|
||||
*ptr_w = siz_w;
|
||||
|
||||
for ( i_w = 1; i_w < siz_w; i_w++ ) {
|
||||
ptr_w[i_w] = u3r_mug((0xffff & (c3_p)(ptr_w)) + i_w);
|
||||
}
|
||||
return ptr_w;
|
||||
}
|
||||
|
||||
static void
|
||||
_test_free(c3_w* ptr_w)
|
||||
{
|
||||
c3_w i_w, siz_w = *ptr_w;
|
||||
|
||||
for ( i_w = 1; i_w < siz_w; i_w++ ) {
|
||||
c3_assert(ptr_w[i_w] == u3r_mug((0xffff & (c3_p)(ptr_w)) + i_w));
|
||||
}
|
||||
u3a_free(ptr_w);
|
||||
}
|
||||
|
||||
#define NUM 16384
|
||||
|
||||
// Simple allocation test.
|
||||
//
|
||||
void
|
||||
test(void)
|
||||
{
|
||||
c3_w* one_w[NUM];
|
||||
c3_w* two_w[NUM];
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
c3_w siz_w = c3_max(1, u3r_mug(i_w) & 0xff);
|
||||
|
||||
one_w[i_w] = _test_walloc(siz_w);
|
||||
two_w[i_w] = _test_walloc(siz_w);
|
||||
}
|
||||
_road_sane();
|
||||
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
_test_free(two_w[NUM - (i_w + 1)]);
|
||||
_road_sane();
|
||||
}
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
c3_w siz_w = c3_max(1, u3r_mug(i_w + 1) & 0xff);
|
||||
|
||||
two_w[i_w] = _test_walloc(siz_w);
|
||||
_road_sane();
|
||||
}
|
||||
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
_test_free(one_w[NUM - (i_w + 1)]);
|
||||
_road_sane();
|
||||
}
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
c3_w siz_w = c3_max(1, u3r_mug(i_w + 2) & 0xff);
|
||||
|
||||
one_w[i_w] = _test_walloc(siz_w);
|
||||
_road_sane();
|
||||
}
|
||||
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
_test_free(one_w[NUM - (i_w + 1)]);
|
||||
_road_sane();
|
||||
}
|
||||
for ( i_w = 0; i_w < NUM; i_w++ ) {
|
||||
_test_free(two_w[NUM - (i_w + 1)]);
|
||||
_road_sane();
|
||||
}
|
||||
|
||||
printf("allocations %d, iterations %d\n", ALL_w, ITE_w);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
static void
|
||||
_test_hash(void)
|
||||
{
|
||||
// u3m_dump();
|
||||
{
|
||||
u3h_root* har_u = u3h_new();
|
||||
c3_w i_w;
|
||||
c3_w max_w = (1 << 20);
|
||||
|
||||
for ( i_w = 0; i_w < max_w; i_w++ ) {
|
||||
u3_noun key = u3nc(0, i_w);
|
||||
|
||||
u3h_put(har_u, key, (i_w + 1));
|
||||
u3z(key);
|
||||
}
|
||||
for ( i_w = 0; i_w < max_w; i_w++ ) {
|
||||
u3_noun key = u3nc(0, i_w);
|
||||
u3_noun val = u3h_get(har_u, key);
|
||||
|
||||
if ( val != (i_w + 1) ) {
|
||||
if ( u3_none == val ) {
|
||||
printf("at %d, nothing\n", i_w);
|
||||
}
|
||||
else printf("at %d, oddly, is %d\n", i_w, val);
|
||||
c3_assert(0);
|
||||
}
|
||||
u3z(key);
|
||||
}
|
||||
u3h_free(har_u);
|
||||
}
|
||||
// u3m_dump();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
static void
|
||||
_test_jam(void)
|
||||
{
|
||||
// u3m_dump();
|
||||
{
|
||||
u3_noun pil = u3_walk_load("urb/urbit.pill");
|
||||
u3_noun cue, jam;
|
||||
|
||||
printf("cueing pill - %d bytes\n", u3r_met(3, pil));
|
||||
cue = u3ke_cue(pil);
|
||||
printf("cued - mug %x\n", u3r_mug(cue));
|
||||
|
||||
#if 1
|
||||
jam = u3ke_jam(cue);
|
||||
printf("jammed - %d bytes\n", u3r_met(3, jam));
|
||||
cue = u3ke_cue(jam);
|
||||
printf("cued - mug %x\n", u3r_mug(cue));
|
||||
#endif
|
||||
|
||||
u3z(cue);
|
||||
}
|
||||
// u3m_dump();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_test_leap(void)
|
||||
{
|
||||
#if 1
|
||||
// u3m_dump();
|
||||
{
|
||||
u3_noun pil;
|
||||
u3_noun cue, jam;
|
||||
c3_w gof_w = u3m_golf();
|
||||
|
||||
pil = u3_walk_load("urb/urbit.pill");
|
||||
u3m_leap(0);
|
||||
printf("cueing pill - %d bytes\n", u3r_met(3, pil));
|
||||
cue = u3ke_cue(pil);
|
||||
printf("cued - %p, mug %x\n", u3a_to_ptr(cue), u3r_mug(cue));
|
||||
u3m_fall();
|
||||
|
||||
cue = u3a_take(cue);
|
||||
printf("taken - %p, mug %x\n", u3a_to_ptr(cue), u3r_mug(cue));
|
||||
u3m_flog(gof_w);
|
||||
u3z(pil);
|
||||
|
||||
#if 1
|
||||
jam = u3ke_jam(cue);
|
||||
printf("jammed - %d bytes\n", u3r_met(3, jam));
|
||||
cue = u3ke_cue(jam);
|
||||
printf("cued - mug %x\n", u3r_mug(cue));
|
||||
#endif
|
||||
|
||||
u3z(cue);
|
||||
}
|
||||
// u3m_dump();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
_test_test(void)
|
||||
{
|
||||
u3_noun fol = u3ke_cue(u3_walk_load("pill/west.pill"));
|
||||
u3_noun val;
|
||||
|
||||
printf("test_test: formula mug %x\n", u3r_mug(fol));
|
||||
val = u3n_nock_on(u3nc(42, 17), fol);
|
||||
printf("val %d\n", val);
|
||||
u3z(val);
|
||||
}
|
||||
|
||||
int FOO;
|
||||
|
||||
// A simple memory tester.
|
||||
//
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
printf("hello, world: len %dMB\n", (1 << U3_OS_LoomBits) >> 18);
|
||||
// _test_words();
|
||||
|
||||
u3m_init();
|
||||
u3m_pave(c3y, c3n);
|
||||
// u3j_boot();
|
||||
|
||||
// u3m_dump();
|
||||
|
||||
printf("booted.\n");
|
||||
|
||||
{
|
||||
_test_leap();
|
||||
// _test_hash();
|
||||
// _test_jam();
|
||||
}
|
||||
// u3m_clear();
|
||||
|
||||
// u3m_dump();
|
||||
}
|
@ -10,12 +10,12 @@ ship=$1
|
||||
test -d $ship/.urb
|
||||
test -f $ship/.vere.lock
|
||||
|
||||
urb $ship -p hood -d '+hood/autoload |'
|
||||
herb $ship -p hood -d '+hood/autoload |'
|
||||
|
||||
urb $ship -p hood -d "+hood/mount %"
|
||||
herb $ship -p hood -d "+hood/mount %"
|
||||
|
||||
rm -r $ship/home
|
||||
|
||||
cp -r pkg/arvo $ship/home
|
||||
|
||||
urb $ship -p hood -d "+hood/commit %home"
|
||||
herb $ship -p hood -d "+hood/commit %home"
|
||||
|
Loading…
Reference in New Issue
Block a user