Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs11-async
make
Commits
54c3e1dd
Commit
54c3e1dd
authored
4 years ago
by
Caleb C. Sander
Browse files
Options
Download
Email Patches
Plain Diff
Fix #2
parent
10b7e431
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
README.md
+3
-3
README.md
make.js
+5
-1
make.js
package.json
+1
-0
package.json
tests/test-concurrent.js
+3
-1
tests/test-concurrent.js
tests/test-dag.js
+3
-1
tests/test-dag.js
tests/test-special-cases.js
+3
-1
tests/test-special-cases.js
tests/test-tree.js
+3
-1
tests/test-tree.js
with
21 additions
and
8 deletions
+21
-8
README.md
View file @
54c3e1dd
...
...
@@ -21,7 +21,7 @@ If you have a macOS or Linux machine, you should be able to download the CS 24 [
$ cd project05
# Build the interactive subpython interpreter
$ n
ode ../
make
.js
../tests/cs24-project05.js subpython
$ n
pm run
make ../tests/cs24-project05.js subpython
# Use the subpython interpreter
$ ./subpython -m 100000
...
...
@@ -33,10 +33,10 @@ Using a memory size of 100000 bytes.
3
# Remove all built files
$ n
ode ../
make
.js
../tests/cs24-project05.js clean
$ n
pm run
make ../tests/cs24-project05.js clean
# Run the tests (they fail on the starter code)
$ n
ode ../
make
.js
../tests/cs24-project05.js test
$ n
pm run
make ../tests/cs24-project05.js test
```
If you don't have
`clang`
installed, you can change the C compiler to
`gcc`
at the top of the makefile.
If you've taken CS 24, try building and testing the completed version of the project!
This diff is collapsed.
Click to expand it.
make.js
View file @
54c3e1dd
...
...
@@ -2,6 +2,10 @@ const {execFile} = require('child_process')
const
path
=
require
(
'
path
'
)
const
{
promisify
}
=
require
(
'
util
'
)
// If running as `npm run make`, use the current directory the command was run in
const
{
INIT_CWD
}
=
process
.
env
if
(
INIT_CWD
)
process
.
chdir
(
INIT_CWD
)
// A version of child_process.execFile() that returns a Promise
const
exec
=
promisify
(
execFile
)
/**
...
...
@@ -22,7 +26,7 @@ function runCommand(command) {
}
const
[
recipesFile
,
...
targets
]
=
process
.
argv
.
slice
(
2
)
if
(
!
recipesFile
)
throw
new
Error
(
'
Missing recipes file
'
)
if
(
!
recipesFile
)
throw
new
Error
(
'
Usage: npm run make makefile.js target1 ... targetN
'
)
/* We get the exports from `recipesFile` using require().
* require() is blocking, but this is okay
...
...
This diff is collapsed.
Click to expand it.
package.json
View file @
54c3e1dd
...
...
@@ -3,6 +3,7 @@
"version"
:
"1.0.0"
,
"description"
:
"CS 11 Asynchronous Programming - Make"
,
"scripts"
:
{
"make"
:
"node make.js"
,
"test"
:
"ava --verbose tests/test-*.js"
},
"repository"
:
{
...
...
This diff is collapsed.
Click to expand it.
tests/test-concurrent.js
View file @
54c3e1dd
...
...
@@ -3,6 +3,8 @@ const path = require('path')
const
test
=
require
(
'
ava
'
)
const
{
execFilePromise
,
matchOutput
}
=
require
(
'
./util
'
)
// We are going to run the server directly, not through npm
const
{
INIT_CWD
,
...
MAKE_ENV
}
=
process
.
env
process
.
chdir
(
__dirname
)
async
function
make
(
dir
,
...
targets
)
{
...
...
@@ -12,7 +14,7 @@ async function make(dir, ...targets) {
const
{
stdout
}
=
await
execFilePromise
(
'
node
'
,
[
'
../../make.js
'
,
'
../concurrent-makefile.js
'
,
...
targets
],
{
cwd
:
path
.
join
(
__dirname
,
dir
)
}
{
cwd
:
dir
,
env
:
MAKE_ENV
}
)
return
stdout
}
...
...
This diff is collapsed.
Click to expand it.
tests/test-dag.js
View file @
54c3e1dd
...
...
@@ -4,6 +4,8 @@ const test = require('ava')
const
{
copyFiles
,
execFilePromise
,
matchOutput
,
wait
}
=
require
(
'
./util
'
)
const
recipes
=
require
(
'
./dag-makefile
'
)
// We are going to run the server directly, not through npm
const
{
INIT_CWD
,
...
MAKE_ENV
}
=
process
.
env
process
.
chdir
(
__dirname
)
const
FILES_DIR
=
'
dag-files
'
...
...
@@ -24,7 +26,7 @@ function touch(file) {
async
function
makeDag
(
dir
,
...
targets
)
{
const
{
stdout
}
=
await
execFilePromise
(
'
node
'
,
[
'
../../make.js
'
,
'
../dag-makefile.js
'
,
...
targets
],
{
cwd
:
path
.
resolve
(
__dirname
,
dir
)
}
{
cwd
:
dir
,
env
:
MAKE_ENV
}
)
return
stdout
}
...
...
This diff is collapsed.
Click to expand it.
tests/test-special-cases.js
View file @
54c3e1dd
...
...
@@ -3,6 +3,8 @@ const path = require('path')
const
test
=
require
(
'
ava
'
)
const
{
execFilePromise
,
matchOutput
,
wait
}
=
require
(
'
./util
'
)
// We are going to run the server directly, not through npm
const
{
INIT_CWD
,
...
MAKE_ENV
}
=
process
.
env
process
.
chdir
(
__dirname
)
async
function
makeC
(
dir
)
{
...
...
@@ -16,7 +18,7 @@ async function makeC(dir) {
async
function
make
(
dir
,
...
targets
)
{
const
{
stdout
}
=
await
execFilePromise
(
'
node
'
,
[
'
../../make.js
'
,
'
../special-cases-makefile.js
'
,
...
targets
],
{
cwd
:
path
.
resolve
(
__dirname
,
dir
)
}
{
cwd
:
dir
,
env
:
MAKE_ENV
}
)
return
stdout
}
...
...
This diff is collapsed.
Click to expand it.
tests/test-tree.js
View file @
54c3e1dd
...
...
@@ -4,6 +4,8 @@ const test = require('ava')
const
{
copyFiles
,
execFilePromise
,
matchOutput
,
wait
}
=
require
(
'
./util
'
)
const
recipes
=
require
(
'
./tree-makefile
'
)
// We are going to run the server directly, not through npm
const
{
INIT_CWD
,
...
MAKE_ENV
}
=
process
.
env
process
.
chdir
(
__dirname
)
const
FILES_DIR
=
'
tree-files
'
...
...
@@ -170,7 +172,7 @@ const CHANGE_TESTS = [
async
function
makeTree
(
dir
)
{
const
{
stdout
}
=
await
execFilePromise
(
'
node
'
,
[
'
../../make.js
'
,
'
../tree-makefile.js
'
,
ROOT_TARGET
],
{
cwd
:
path
.
resolve
(
__dirname
,
dir
)
}
{
cwd
:
dir
,
env
:
MAKE_ENV
}
)
return
stdout
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment