test65 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb249a06581fa2e69553600dc88ec52b620db6d5
4
- data.tar.gz: cdbc6072308051d64c07c61e0c9d07ded8319b2e
3
+ metadata.gz: ce0b53ee6e1abb5f043427d993e103352f195fc2
4
+ data.tar.gz: 8f4cb1e01eb2f3fd19d5d05f1393b744a8547b63
5
5
  SHA512:
6
- metadata.gz: cca5d442da99eb33a2fcc40f40029e4981e03fddeb037cb7b1e8b5123235b2725e0bc40a4e9927e9bb394827535048b9e5ad7d93ad360e25f99cfba2517ddc59
7
- data.tar.gz: fdb97d5bbe8f9c7671904ab4591749740e2860d544416a04e269d13a5caac869da6c3173997d7b756b2db21b6ec0ff2ccd8cfed7fd75a7834b164514e2c5fd01
6
+ metadata.gz: 4863b308d617644627b0727380de7c6d7a5527ad37fdb317065a358b11289d215f5296eba4e10b6da9a2b82a5e533e898eb3438a4ff0441c7e228822e8d19404
7
+ data.tar.gz: 10fad1c205776264cd83ba4d99ba654f79e6efd7bae25d389dbd233f2284b770ae2e920351082c54d385b792c1ca8ff1c3257f07a285be2bd20c7c77486f785a
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.out
2
2
  *.o
3
3
  *.lst
4
+ *.s
4
5
  pkg
5
6
  foo
data/help.txt CHANGED
@@ -1,4 +1,4 @@
1
- test65 - Run tests of 65c02 assembler code.
1
+ test65 - Run tests of 65C02 C and assembler code.
2
2
 
3
3
  Usage: test65 {options} {files}
4
4
 
@@ -19,6 +19,6 @@ Notes:
19
19
  - By default, test files are located in a folder called "t65" in the current
20
20
  folder or one of its parent folders.
21
21
  - Wildcards are allowed for files but not the path.
22
- - If no files are specified, then all files matching "t65*.a65" or "t65*.rb"
23
- in the test folder are tested.
22
+ - If no files are specified, then all files matching "t65*.c65", "t65*.a65",
23
+ "t65*.c", "t65*.asm", or "t65*.rb" in the test folder are tested.
24
24
  - If files are specified, only the specified file(s) are tested.
@@ -15,6 +15,9 @@ module Test65
15
15
  # Scan the path for files to be processed.
16
16
  def self.scan_files
17
17
  @test_files = Dir.glob(@options[:path] + "/t65*.a65") +
18
+ Dir.glob(@options[:path] + "/t65*.asm") +
19
+ Dir.glob(@options[:path] + "/t65*.c65") +
20
+ Dir.glob(@options[:path] + "/t65*.c") +
18
21
  Dir.glob(@options[:path] + "/t65*.rb")
19
22
  fail "Cannot locate any test files" if @test_files.empty?
20
23
  end
@@ -3,28 +3,27 @@ class TestScript
3
3
 
4
4
  # Setup ca65
5
5
  def ca65_initialize
6
- @options[:target] = "sim65c02"
7
- @options[:ca65_paths] = ["#{@options[:gem_root]}/asminc"]
8
- @options[:objs] = []
6
+ @options[:ca65_target] = "sim65c02"
7
+ @options[:ca65_inc_paths] = ["#{@options[:gem_root]}/asminc"]
9
8
  end
10
9
 
11
10
  # Add some include paths for the assembler.
12
11
  def ca65_inc_paths(*more_paths)
13
12
  fail "Sequence error: ca65_inc_paths" unless @phase == :create
14
- append_option(:inc_paths, more_paths)
13
+ append_option(:ca65_inc_paths, more_paths)
15
14
  end
16
15
 
17
16
  # Assemble some files.
18
17
  def ca65(file, options="")
19
18
  fail "Sequence error: ca65" unless @phase == :create
20
19
  source = File.absolute_path(@options[:path] + "/" + file)
21
- target = "--target #{@options[:target]} "
22
- paths = build_args("-I", @options[:ca65_paths])
20
+ target = "--target #{@options[:ca65_target]} "
21
+ paths = build_args("-I", @options[:ca65_inc_paths])
23
22
 
24
- # Convert source assemble files into object files.
23
+ # Convert source assembler files into object files.
25
24
  object = change_type(source, ".o")
26
25
  list = @options[:list] ? "-l " + change_type(source, ".lst") : ""
27
- command = "ca65 #{target}#{paths}#{list}#{options} -o #{object} #{source} #{@quiet}\n"
26
+ command = "ca65 #{target}#{paths}#{list} #{options} -o #{object} #{source} #{@quiet}\n"
28
27
  puts command if @options[:debug]
29
28
  system(command)
30
29
  fail "Error assembling #{source.localize_path}" unless $?.exitstatus == 0
@@ -0,0 +1,43 @@
1
+ # An enclosure for the cc65 compiler.
2
+ class TestScript
3
+
4
+ # Setup cc65
5
+ def cc65_initialize
6
+ @options[:cc65_target] = "sim65c02"
7
+ @options[:cc65_inc_paths] = ["#{@options[:gem_root]}/include"]
8
+ end
9
+
10
+ # Add some include paths for the compiler.
11
+ def cc65_inc_paths(*more_paths)
12
+ fail "Sequence error: cc65_inc_paths" unless @phase == :create
13
+ append_option(:cc65_inc_paths, more_paths)
14
+ end
15
+
16
+ # Compile some files.
17
+ def cc65(file, options="")
18
+ fail "Sequence error: cc65" unless @phase == :create
19
+ source = File.absolute_path(@options[:path] + "/" + file)
20
+ target = "--target #{@options[:cc65_target]} "
21
+ paths = build_args("--include-dir", @options[:cc65_inc_paths])
22
+
23
+ # Convert source C files into assembler files.
24
+ list = @options[:list] ? "--add-source " : " "
25
+ command = "cc65 #{target}#{list}#{paths}#{options} #{source} #{@quiet}\n"
26
+ puts command if @options[:debug]
27
+ system(command)
28
+ fail "Error compiling #{source.localize_path}" unless $?.exitstatus == 0
29
+
30
+ # Convert intermediate assembler files into object files.
31
+ temp = change_type(source, ".s")
32
+ object = change_type(source, ".o")
33
+ list = @options[:list] ? "-l " + change_type(source, ".lst") : ""
34
+ command = "ca65 #{target}#{list} -o #{object} #{temp} #{@quiet}\n"
35
+ puts command if @options[:debug]
36
+ system(command)
37
+ fail "Error assembling #{source.localize_path}" unless $?.exitstatus == 0
38
+
39
+ @options[:temps] << temp
40
+ @options[:objs] << object
41
+ end
42
+
43
+ end
@@ -1,6 +1,7 @@
1
1
  # Run a test script for the test65 program.
2
2
 
3
3
  require_relative 'enclosures/utils'
4
+ require_relative 'enclosures/cc65'
4
5
  require_relative 'enclosures/ca65'
5
6
  require_relative 'enclosures/ld65'
6
7
  require_relative 'enclosures/sim65'
@@ -12,6 +13,10 @@ class TestScript
12
13
  @options = options.full_dup
13
14
  @phase = :create
14
15
 
16
+ @options[:objs] = []
17
+ @options[:temps] = []
18
+
19
+ cc65_initialize
15
20
  ca65_initialize
16
21
  ld65_initialize
17
22
  sim65_initialize
@@ -25,6 +30,10 @@ class TestScript
25
30
  unless @options[:keep]
26
31
  File.delete(@output) if File.exists?(@output)
27
32
 
33
+ @options[:temps].each do |file|
34
+ File.delete(file) if File.exists?(file)
35
+ end
36
+
28
37
  @options[:objs].each do |file|
29
38
  File.delete(file) if File.exists?(file)
30
39
  end
@@ -21,8 +21,11 @@ module Test65
21
21
  def self.process_file(file)
22
22
  puts file.localize_path if @options[:verbose]
23
23
 
24
- case File.extname(file)
25
- when ".a65"
24
+ case File.extname(file).downcase
25
+ when ".c65", ".c"
26
+ script { cc65(File.basename(file)); ld65; sim65 }
27
+
28
+ when ".a65", ".asm"
26
29
  script { ca65(File.basename(file)); ld65; sim65 }
27
30
 
28
31
  when ".rb"
@@ -1,5 +1,5 @@
1
1
  module Test65
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.6.0".freeze
3
3
 
4
4
  DESCRIPTION = "test65: A testing framework for ca65.".freeze
5
5
  end
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that passes.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit_stage_left(0);
8
+ }
@@ -0,0 +1,9 @@
1
+ # Minimum script to pass a test.
2
+
3
+ Test65.script do
4
+
5
+ ca65 "min_fail.a65"
6
+ ld65
7
+ sim65
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ # Minimum script to pass a test in C.
2
+
3
+ Test65.script do
4
+
5
+ cc65 "min_fail_c.c65"
6
+ ld65
7
+ sim65
8
+
9
+ end
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that fails.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit(255);
8
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ # Minimum script to pass a test in C.
2
+
3
+ Test65.script do
4
+
5
+ cc65 "min_pass_c.c65"
6
+ ld65
7
+ sim65
8
+
9
+ end
@@ -0,0 +1,12 @@
1
+ ; Minimum code that passes a test
2
+
3
+ .import exit:absolute
4
+ .export _main
5
+
6
+ .pc02
7
+
8
+ .code
9
+
10
+ _main:
11
+ lda #0
12
+ jmp exit
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that passes.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit(0);
8
+ }
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that passes.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit(0);
8
+ }
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that passes.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit(0);
8
+ }
@@ -0,0 +1,8 @@
1
+ // Minimum test in "C" that passes.
2
+
3
+ #include <stdlib.h>
4
+
5
+ int main(void)
6
+ {
7
+ exit(0);
8
+ }
@@ -0,0 +1,13 @@
1
+ ; Minimum code that passes a test
2
+
3
+ .include "test65.i65"
4
+ .export _main
5
+ .pc02
6
+
7
+ .zeropage
8
+ mem1: .res 32
9
+
10
+ .code
11
+
12
+ _main:
13
+ tests_pass
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test65
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PeterCamilleri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2020-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: full_dup
@@ -86,6 +86,7 @@ files:
86
86
  - lib/test65.rb
87
87
  - lib/test65/build_file_list.rb
88
88
  - lib/test65/enclosures/ca65.rb
89
+ - lib/test65/enclosures/cc65.rb
89
90
  - lib/test65/enclosures/ld65.rb
90
91
  - lib/test65/enclosures/sim65.rb
91
92
  - lib/test65/enclosures/utils.rb
@@ -98,6 +99,7 @@ files:
98
99
  - lib/test65/version.rb
99
100
  - rakefile.rb
100
101
  - t65/asm_err.a65
102
+ - t65/c_err.c65
101
103
  - t65/callee.a65
102
104
  - t65/caller.a65
103
105
  - t65/foo.txt
@@ -105,10 +107,20 @@ files:
105
107
  - t65/macro_err1.a65
106
108
  - t65/macro_err2.a65
107
109
  - t65/min_fail.a65
110
+ - t65/min_fail2.rb
111
+ - t65/min_fail2_c.rb
112
+ - t65/min_fail_c.c65
108
113
  - t65/min_pass.a65
109
- - t65/min_pass.rb
114
+ - t65/min_pass2.rb
115
+ - t65/min_pass2_c.rb
116
+ - t65/min_pass3.asm
117
+ - t65/min_pass3_c.c
118
+ - t65/min_pass_c.c65
110
119
  - t65/pass.a65
111
120
  - t65/t65_min_pass.rb
121
+ - t65/t65_pass2_c.c
122
+ - t65/t65_pass_c.c65
123
+ - t65/t65_test2_cfg.asm
112
124
  - t65/t65_test_cfg.a65
113
125
  - t65/t65_test_macros.a65
114
126
  - t65/t65_two_files.rb