<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -225,56 +225,6 @@ collect(pid_t *pid, collect_fn fn, void *data)
 }
 
 static void
-exec(void *data)
-{
-    int r;
-
-    char **info = (char **) data;
-    r = execvp(info[0], info);
-    die(5, &quot;Wrong execvp&quot;);
-}
-
-/* Read the full symbol table (not just the dynamic symbols) and return the
- * value of the specified symbol. If an error occurs, print an error message
- * and exit.
- *
- * We cheat by using &quot;nm&quot; to parse the symbol table of the file on disk.
- */
-void *
-__cut_debug_addr(const char *sym, const char *file, int line)
-{
-    void *val;
-    FILE *out;
-    pid_t pid;
-    int status, r;
-    char cmd[BUF_SIZE], s[BUF_SIZE];
-    char *args[] = { &quot;sh&quot;, &quot;-c&quot;, cmd, 0 };
-
-    sprintf(cmd, &quot;nm %s | grep ' %s$'&quot;, program, sym);
-
-    out = collect(&amp;pid, exec, args);
-    if (!out) die(1, &quot;  %s:%d: collect&quot;, file, line);
-
-    pid = waitpid(pid, &amp;status, 0);
-    if (pid &lt; 1) die(1, &quot;  %s:%d: wait&quot;, file, line);
-
-    rewind(out);
-    r = fread(s, 1, BUF_SIZE - 1, out);
-    if (!r) printf(&quot;  %s:%d: no symbol: %s\n&quot;, file, line, sym), exit(1);
-
-    s[r] = 0;
-
-    errno = 0;
-    val = (void *) strtoul(s, 0, 16);
-    if (errno) die(1, &quot;  %s:%d: strtoul on ``%s''&quot;, file, line, s);
-    if (((size_t) val) &lt; 100) {
-        die(1, &quot;  %s:%d: strtoul on ``%s''&quot;, file, line, s);
-    }
-
-    return val;
-}
-
-static void
 run_in_child(void *data)
 {
     int r;
@@ -294,7 +244,7 @@ void
 __cut_run(char *group_name, cut_fn bringup, cut_fn takedown, char *test_name,
         cut_fn test, char *filename, int lineno)
 {
-    pid_t pid;
+    pid_t pid = -1;
     int status, r;
     FILE *out;
     test_output to;</diff>
      <filename>cut.c</filename>
    </modified>
    <modified>
      <diff>@@ -41,8 +41,6 @@ void cut_exit(void);
                           __FILE__, \
                           __LINE__);
 
-#define ADDR(S) (__cut_debug_addr(#S, __FILE__, __LINE__))
-
 #define ASSERT(X,msg)        __cut_assert(__FILE__,__LINE__,msg,#X,X)
 
 #define STATIC_ASSERT(X)  extern bool __static_ASSERT_at_line_##__LINE__##__[ (0!=(X))*2-1 ];
@@ -55,7 +53,6 @@ void cut_exit(void);
 
 void __cut_run(char *, cut_fn, cut_fn, char *, cut_fn, char *, int);
 void __cut_assert( char *, int, char *, char *, int );
-void *__cut_debug_addr(const char *, const char *, int);
 
 #endif
 </diff>
      <filename>cut.h</filename>
    </modified>
    <modified>
      <diff>@@ -263,6 +263,13 @@ total_jobs()
     return next_id - 1;
 }
 
+/* for unit tests */
+size_t
+get_all_jobs_used()
+{
+    return all_jobs_used;
+}
+
 void
 job_init()
 {</diff>
      <filename>job.c</filename>
    </modified>
    <modified>
      <diff>@@ -87,6 +87,9 @@ void job_insert(job head, job j);
 
 unsigned long long int total_jobs();
 
+/* for unit tests */
+size_t get_all_jobs_used();
+
 void job_init();
 
 #endif /*job_h*/</diff>
      <filename>job.h</filename>
    </modified>
    <modified>
      <diff>@@ -97,19 +97,18 @@ void
 __CUT__job_test_all_jobs_used()
 {
     job j, x;
-    size_t *all_jobs_used_ptr = ADDR(all_jobs_used);
 
     j = make_job(0, 0, 1, 0, default_tube);
-    ASSERT(*all_jobs_used_ptr == 1, &quot;should match&quot;);
+    ASSERT(get_all_jobs_used() == 1, &quot;should match&quot;);
 
     x = allocate_job(10);
-    ASSERT(*all_jobs_used_ptr == 1, &quot;should match&quot;);
+    ASSERT(get_all_jobs_used() == 1, &quot;should match&quot;);
 
     job_free(x);
-    ASSERT(*all_jobs_used_ptr == 1, &quot;should match&quot;);
+    ASSERT(get_all_jobs_used() == 1, &quot;should match&quot;);
 
     job_free(j);
-    ASSERT(*all_jobs_used_ptr == 0, &quot;should match&quot;);
+    ASSERT(get_all_jobs_used() == 0, &quot;should match&quot;);
 }
 
 void</diff>
      <filename>tests/test_job.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>95ff7060d7b0ca92dfd472fcd5719272831b519c</id>
    </parent>
  </parents>
  <author>
    <name>Keith Rarick</name>
    <email>kr@xph.us</email>
  </author>
  <url>http://github.com/kr/beanstalkd/commit/5192ce554ba612b302052314564bd5eb2981b913</url>
  <id>5192ce554ba612b302052314564bd5eb2981b913</id>
  <committed-date>2009-05-15T16:41:48-07:00</committed-date>
  <authored-date>2009-05-15T16:37:27-07:00</authored-date>
  <message>Ditch that symbol table hack. It's not portable.

In particular, Mac OS and probably BSD don't like it.

Closes gh-8.</message>
  <tree>16609b2407526338803b208cd59e9af0637b4657</tree>
  <committer>
    <name>Keith Rarick</name>
    <email>kr@xph.us</email>
  </committer>
</commit>
